Openfire 预绑定 + robbiehanson/XMPPFramework 使用 BOSH 不起作用

发布于 2024-12-21 04:17:29 字数 2806 浏览 2 评论 0原文

我们正在尝试为我们的产品通过 BOSH 实现 XMPPStrope.js javascript 库可以很好地满足我们在 WWW 站点上的需求。我们请求预绑定,它被传递,然后我们使用 Strope 的“附加”方法来启动我们的会话 - 然后我们就能够更新状态并发送/接收消息。在 iOS 方面,我们使用 robbiehanson XMPPFramework,其中包含 BOSH 传输,但没有附加方法。以下是我在尝试让它发挥作用时的一些悲伤。

我预绑定,获取我的 sid/jid/rid,然后设置 bosh 传输和其他文件内的内部逻辑,以表明我们已经连接。然后,如果我尝试更新状态,包括给定的 SID,我会发送:

BOSH:发送[1248340729] = < body xmlns =“http://jabber.org/protocol/httpbind”sid =“568a3ae9”ack =“1248340728”rid =“1248340729”> <存在>< /存在>< /正文>

但根本没有得到任何回复。这是最后一个。如果我尝试在不指定 SID 的情况下更新状态,我会发送:

BOSH:发送[1064338700] = < body xmlns =“http://jabber.org/protocol/httpbind”ack =“1064338699”rid =“1064338700”><存在>< /存在>< /正文>

并返回:

BOSH:RECD[1342811427] = <正文 xmlns="http://jabber.org/protocol/httpbind" xmlns:stream="http://etherx.jabber.org/streams" authid="9ef0ccdb" sid="9ef0ccdb" secure="true" 请求= “2”不活动=“300”轮询=“5”等待=“60”><流:特征><机制 xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> <机制>PLAIN< /机制>< /机制><压缩 xmlns="http://jabber.org/features/compress"><方法>zlib< /方法>< /压缩><绑定 xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><会话 xmlns="urn:ietf:params:xml:ns:xmpp-session"/>< /stream:功能>< /正文>

这看起来像是一个连接确认,或者一个连接挑战节,期望我用 PLAIN 信息进行响应 - 但这已经通过预绑定建立了。如果它是一个连接确认,那么接下来的几行就没有意义。如果使用上面连接字符串提供的 SID,就好像它是一个确认(我不确定),这些是下一行:

BOSH:发送[1342811427] = < body xmlns =“http://jabber.org/protocol/httpbind”sid =“9ef0ccdb”rid =“1342811428”>< iq 类型=“设置”><绑定 xmlns="urn:ietf:params:xml:ns:xmpp-bind"><资源>api< /资源>< /绑定>< /智商>< /正文>

BOSH:RECD[1342811427] = < body xmlns='http://jabber.org/protocol/httpbind'>< iq xmlns="jabber:client" type="error" to="chat.*.com/9ef0ccdb"><绑定 xmlns="urn:ietf:params:xml:ns:xmpp-bind"><资源>api< /资源>< /绑定><错误代码=“401”类型=“auth”><未授权 xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>< /错误>< /智商>< /正文>

我没有被授权。现在,如果我尝试使用预绑定期间协商的 SID,最后两行会有所不同:

BOSH:发送[1172064714​​] = < body xmlns =“http://jabber.org/protocol/httpbind”sid =“27e3745b”rid =“1172064715”>< iq 类型=“设置”><资源>api< /资源>< /绑定>< /智商>< /正文>

BOSH:RECD[1172064714​​] = < body xmlns="http://jabber.org/protocol/httpbind">< /正文>

空洞的回应。然后,如果我尝试再次更新我的状态,它会显示一个文字 404 页面,表明 SID 无效。当我使用 openfire 提供的 SID 时,如果我重新尝试状态更新,它只会继续给我401 notauthorized

任何帮助将不胜感激。

We're trying to implement XMPP over BOSH for our product. The Strophe.js javascript library works fine for our needs on the WWW site. We request a prebind, it's delivered and then we use Strophe's 'attach' method to start our session - then we're able to update presence and send/receive messages. On the iOS side of things, we're using the robbiehanson XMPPFramework which includes a BOSH transport, but there's no attach method. Below is some of my grief with trying to get this to work.

I prebind, get my sid/jid/rid, then set the internal logic inside the bosh transport and other files to say that we're already connected. Then if I try to update presence, including the given SID, I send:

BOSH: SEND[1248340729] = < body xmlns="http://jabber.org/protocol/httpbind" sid="568a3ae9" ack="1248340728" rid="1248340729">< presence>< /presence>< /body>

but don't get any reply atall. That's the last of it. If I try to update presence without specifying SID, I send:

BOSH: SEND[1064338700] = < body xmlns="http://jabber.org/protocol/httpbind" ack="1064338699" rid="1064338700">< presence>< /presence>< /body>

and get back:

BOSH: RECD[1342811427] = < body xmlns="http://jabber.org/protocol/httpbind" xmlns:stream="http://etherx.jabber.org/streams" authid="9ef0ccdb" sid="9ef0ccdb" secure="true" requests="2" inactivity="300" polling="5" wait="60">< stream:features>< mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> < mechanism>PLAIN< /mechanism>< /mechanisms>< 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>

which looks like a connection affirmation, or a connection challenge stanza expecting me to respond with the PLAIN information - but this has already been established with the prebind. If it is a connection affirmation, then the next lines don't make sense. If using the SID provided by the connection string above, as if it's an affirmation (I'm not sure), these are the next lines:

BOSH: SEND[1342811427] = < body xmlns="http://jabber.org/protocol/httpbind" sid="9ef0ccdb" rid="1342811428">< iq type="set">< bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">< resource>api< /resource>< /bind>< /iq>< /body>

BOSH: RECD[1342811427] = < body xmlns='http://jabber.org/protocol/httpbind'>< iq xmlns="jabber:client" type="error" to="chat.*.com/9ef0ccdb">< bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">< resource>api< /resource>< /bind>< error code="401" type="auth">< not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>< /error>< /iq>< /body>

I'm not authorized. Now if I try using the SID that was negotiated during prebind, the last two lines are different:

BOSH: SEND[1172064714] = < body xmlns="http://jabber.org/protocol/httpbind" sid="27e3745b" rid="1172064715">< iq type="set">< resource>api< /resource>< /bind>< /iq>< /body>

BOSH: RECD[1172064714] = < body xmlns="http://jabber.org/protocol/httpbind">< /body>

an empty response. Then if I try updating my presence again, it gives me a literal 404 page saying there's an invalid SID. When I was using the SID provided by openfire, if I re-tried the presence update, it would just keep on giving me 401 not authorized.

Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文