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

前端 未结 3 1679
傲寒
傲寒 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: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.

提交回复
热议问题