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

参考

协议 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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值