【问题标题】:connection error in Strophe with bosh and openfireStrophe 与 bosh 和 openfire 的连接错误
【发布时间】:2014-08-27 12:38:51
【问题描述】:

我正在使用 stophe 示例连接到我的本地 openfire xmpp 服务。我更改了 BOSH 网址以适应我当地的 openfire 服务。 我输入了 JID 和密码并单击了连接按钮。它显示以下消息:

 Strophe is connecting.
SENT: <body rid='1995627735' xmlns='http://jabber.org/protocol/httpbind' to='admin'      xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams' from='mobi-pc' authid='d04856d8' sid='d04856d8' secure='true' requests='2' inactivity='30' polling='5' wait='60' hold='1' ack='1995627735' maxpause='300' ver='1.6'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</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>
SENT: <body rid='1995627736' xmlns='http://jabber.org/protocol/httpbind' sid='d04856d8'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='ANONYMOUS'/></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/></body>
SENT: <body rid='1995627737' xmlns='http://jabber.org/protocol/httpbind' sid='d04856d8' to='admin' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/>
RECV: <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>
SENT: <body rid='1995627738' xmlns='http://jabber.org/protocol/httpbind' sid='d04856d8'><iq type='set' id='_bind_auth_2' xmlns='jabber:client'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_bind_auth_2' to='mobi-pc/d04856d8'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>d04856d8@mobi-pc/d04856d8</jid></bind></iq></body>
SENT: <body rid='1995627739' xmlns='http://jabber.org/protocol/httpbind' sid='d04856d8'><iq type='set' id='_session_auth_2' xmlns='jabber:client'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_session_auth_2' to='d04856d8@mobi-pc/d04856d8'/></body>
Strophe is connected.
Strophe is disconnecting.
SENT: <body rid='1995627740' xmlns='http://jabber.org/protocol/httpbind' sid='d04856d8' type='terminate'><presence xmlns='jabber:client' type='unavailable'/></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind' type='terminate'/>
Strophe is disconnected.

解决这个问题的任何想法

【问题讨论】:

  • 你能给我提供如何使用 strophe 设置 xmpp 聊天的代码吗...我在使用它时遇到了困难..请帮助

标签: xmpp openfire strophe


【解决方案1】:

这根本不是问题..

如果您阅读basic.js(basic.html)的代码,则有一个回调函数

function onConnect(status)
{
    ...
    ...
    } else if (status == Strophe.Status.CONNECTED) {
        log('Strophe is connected.');
        connection.disconnect();
    }
}

表示当状态等于CONNECTED时,记录该消息,然后立即断开连接。

【讨论】:

    猜你喜欢
    • 2014-08-15
    • 2018-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多