您的位置:首页 > 理论基础 > 计算机网络

关于strophe 通过 connection manager 连接到 openfire server 失败 的原因初阶分析http://xmpp.org/extensions/xep-0206.ht

2012-04-25 15:14 791 查看
参考

协议 XMPP XEP-0206 (BOSH)

http://xmpp.org/extensions/xep-0206.html

通过BOSH 创建 会话经历的一般步骤包括

(1)Session Creation 会话创建请求

(2)Authentication 身份验证

(3)Restart request 重启请求

(4)Resource binding request资源绑定请求

问题就出现在第三步的时候,之前步骤都是正确的

参考strophe不通过connection manager 连接到openfire的时候走的就是这个标准流程

(3)(4)数据流如下

(3)Restart request 重启请求

request:

<body rid='539419237' xmlns='http://jabber.org/protocol/httpbind' sid='e957c613'

to='tes-pc-10-05' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/>

response:

<body xmlns="http://jabber.org/protocol/httpbind" xmlns:stream="http://etherx.jabber.org/streams">

<stream:features>

<compression xmlns="http://jabber.org/features/compress">

<method>zlib</method>

</compression>

<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/>

<session xmlns="urn:ietf:params:xml:ns:xmpp-session"/>

</stream:features>

</body>

(4)Resource binding request资源绑定请求

request:

<body rid='539419238' xmlns='http://jabber.org/protocol/httpbind' sid='e957c613'>

<iq type='set' id='_bind_auth_2' xmlns='jabber:client'>

<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>

</iq>

</body>

response:

<body xmlns='http://jabber.org/protocol/httpbind'>

<iq xmlns="jabber:client" type="result" id="_bind_auth_2" to="tes-pc-10-05/e957c613">

<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">

<jid>a@tes-pc-10-05/e957c613</jid>

</bind>

</iq>

</body>

而 connectionmanager 在 3之后就不再返回任何数据一直到超时。

而另外一个库JSJaC,则可以顺利通过 connection manager连上openfire 这是因为

他把3,4合并在一起执行了

数据流如下

request:

<body

rid='812216'

sid='cjyvqeef8619c'

xmlns='http://jabber.org/protocol/httpbind'

key='e6711e9a605a2a1a28257baa57ee7fc69e5eea86'

xmpp:restart='true' <!-- 重启请求-->

xmlns:xmpp='urn:xmpp:xbosh'>

<!-- 资源绑定-->

<iq xmlns="jabber:client" type="set" id="bind_1">

<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">

<resource xmlns="urn:ietf:params:xml:ns:xmpp-bind">jsjac_simpleclient</resource>

</bind>

</iq>


</body>

response:

<body xmlns='http://jabber.org/protocol/httpbind'>

<iq type="result" id="bind_1" to="tes-pc-10-05/cjyvqeef8619c">

<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">

<jid>a@tes-pc-10-05/jsjac_simpleclient</jid>

</bind>

</iq>

</body>

我自己编写了一个js文件修复了这个问题,上传到了我的资源。

下载地址 http://download.csdn.net/detail/suncaishen/4282736
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐