Strophe与bosh和openfire的连接错误

时间:2014-08-27 12:38:51

标签: xmpp openfire strophe bosh

我正在使用示例连接到我的本地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.

克服这个问题的任何想法

1 个答案:

答案 0 :(得分:2)

这根本不是问题..

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

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

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