Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
529 views
in Technique[技术] by (71.8m points)

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

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. First I tried to connect to FB-chat using Pidgin and it worked fine. My conclusion was that FB-chat server is acting as the XMPP server. Is this true?

I read about XMPP, it seems that an open TCP connection should be established between the client and the server to exchange the XML stanzas which is not possible from a website (over JavaScript and without plugins) since only http requests/responses can be exchanges, no TCP connection there. This means that there should be some kind of a proxy in between, and as for authentication, FB API suggests to use the X-FACEBOOK-PLATFORM SASL (not the DIGEST MD5, since there is a proxy). I didn't find a clear tutorial or steps how to do so, help here is appreciated.

A bit more research about XMPP client from the web or browser, I saw that I am supposed to use a library called Strophe (based on BOSH protocol) and in other answers some kind of connection manager called Punjab. I read about this BOSH protocol, it seems to be the solution but in some places I found out that it is not allowed in FB (I am not sure how correct is this info though). I tried to setup these but i was totally confused how to begin and what I am really supposed to do.

For the strophe, I didn't find a real tutorial how to implement it, and in what i found, they suggest to first setup a jabber server like ejabberd (I didnt get the need for that).

My question is:

Can somebody suggest an architecture that I should implement to achieve my goal?

So will there be: webpage ->(HTTP) -> Strophe -> (TCP) -> FB-chat OR will it have an XMPP server in between and why?

I would appreciate any answer to any of my questions. Please suggest some links to how to implement all these stuff. I am totally new to all this which made me lost for more than a week now.

If somebody already did this, please help. Thanks a lot.

Sabah

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Informations about facebook chat server :

Protocol: XMPP or Jabber
Username: mathvdh
Domain: chat.facebook.com
Jabber ID: [email protected]
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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...