建筑从Facebook网页聊天(XMPP?Strophe?Punjab?) [英] architecture to Facebook-chat from a webpage, (XMPP? Strophe? Punjab?)

查看:151
本文介绍了建筑从Facebook网页聊天(XMPP?Strophe?Punjab?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在网页中实施 FB-chat 。我在Facebook API环顾四周,发现聊天只允许使用XMPP。首先,我尝试使用Pidgin连接到FB-chat,它工作正常。我的结论是,FB聊天服务器是作为XMPP服务器。 这是真的吗?

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?

我阅读了关于XMPP,似乎应该在客户端和服务器之间建立一个开放的TCP连接来交换XML节点是不可能从网站(通过JavaScript和没有插件),因为只有http请求/响应可以交换,没有TCP连接。这意味着应该有一些代理,对于身份验证,FB API建议使用X-FACEBOOK-PLATFORM SASL(不是DIGEST MD5,因为有一个代理)。

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.

有关XMPP客户端的更多研究网络或浏览器,我看到我应该使用一个名为 Strophe 的库(基于 BOSH 协议),在其他答案中,某种连接管理器称为旁遮普即可。我读了这个BOSH协议,似乎是解决方案,但在某些地方,我发现它不允许在FB(我不知道这个信息是否正确)。我试图设置这些,但我完全困惑如何开始和我真正应该做的。

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.

对于strophe,我没有找到一个真正的教程如何实现它,在我发现的时候,他们建议先设置一个像ejabberd这样的jabber服务器(我没有得到这个需要)。

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).

我的问题是:

有人可以建议我应该实现的架构来实现我的目标吗?

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

那么会有:网页 - >(HTTP) - > Strophe - >(TCP) - > FB聊天或者它之间是否有一个XMPP服务器,为什么?

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.

沙巴

推荐答案

也试图解决这个问题。到目前为止,我已经决定设置:

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

Jappix mini(使用JSJAC.js库)< - > node-xmpp-bosh on node.js on my服务器< - > Facebook服务器。

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

Jappix mini很难找到,但它似乎是迄今为止最好的开源聊天栏,值得一提。

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

我没有全部设置,但如果我取得进展,会在这里更新。主要的问题将是如何使JSJAC使用Facebook API密钥认证。我找不到任何信息或示例,但是我发现这个插件可能适用于strophe库:

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

最后,您不能在javascript中包含您的Facebook密钥(因为这是一个秘密!),所以您需要使用Facebook REST API认证。 promotionSession服务器端生成会话密钥,可以在javascript中使用来签名X-FACEBOOK-PLATFORM认证请求。

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.

这篇关于建筑从Facebook网页聊天(XMPP?Strophe?Punjab?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆