architecture to Facebook-chat from a webpage, (XMPP? Strophe? Punjab?)

前端 未结 3 1676
傲寒
傲寒 2020-12-15 12:15

I would like to implement FB-chat inside a webpage. I looked around in Facebook API, i found out that chat is allowed only using XMPP. Firs

相关标签:
3条回答
  • 2020-12-15 13:04

    Informations about facebook chat server :

    Protocol: XMPP or Jabber
    Username: mathvdh
    Domain: chat.facebook.com
    Jabber ID: mathvdh@chat.facebook.com
    Password: <your Facebook password>
    Port: 5222
    Server: chat.facebook.com
    Use SSL/TLS: no
    Allow plaintext authentication: no
    

    I think strophe and punjab should be a working combination for fb chat, see here : XMPP library for facebook chat

    And I think the schema would be more like :

    client webpage/js/strophe <-> yourserver/punjab <-> facebook xmpp chat server

    0 讨论(0)
  • 2020-12-15 13:04

    Sabah,

    As mentioned in the previous answers the Punjab <-> strophe.js works. I have forked the facebook strophe client here: https://github.com/javierfigueroa/turedsocial and I added an example.

    Hope this helps.

    0 讨论(0)
  • 2020-12-15 13:08

    I'm trying to solve this problem too. So far I have decided on a set up of:

    Jappix mini (uses JSJAC.js library) <-> node-xmpp-bosh on node.js on my server <-> Facebook server.

    Jappix mini was hard to find but it seems by far the best open source chat bar so worth mentioning here.

    I don't have it all set up yet but will update here if I make progress. The main issue will be how to make JSJAC use Facebook API Key authentication. I can't find any info or examples for that, but I found this plugin for strophe library which maybe can be adapted:

    https://github.com/rubenjgarciab/turedsocial/blob/master/strophe-plugins/src/facebook.js

    Finally, you cannot include your facebook secret key in javascript (because it's a secret!) so you need to use Facebook REST API auth.promoteSession server-side to produce a session-secret key which can be used in the javascript to sign the X-FACEBOOK-PLATFORM auth request.

    Hope that helps, I'll add more if/when I get it working.

    0 讨论(0)
提交回复
热议问题