无法使用Localhost上的Strophe.js连接到OpenFire

时间:2015-01-25 08:04:40

标签: xmpp openfire strophe bosh

我在我的localhost上安装了OpenFire,并通过端口7070上的http启用了Bosh连接。我下载了最新的strophe.jsflXHR.js用于连接和跨域连接,但到目前为止,它无法成功连接。

我搜索了SO以寻找答案,我尝试了但仍然没有成功。

以下是我的代码;

$(document).bind("connect", function (ev, data) {

var conn = new Strophe.Connection("http://127.0.0.1:7070/http-bind/");

conn.connect(data.jid, data.password, function (status) {
    if (status === Strophe.Status.CONNECTED) {
        $(document).trigger("connected");
    } else if (status === Strophe.Status.DISCONNECTED) {
        $(document).trigger("disconnected");
    }
    Hello.connection = conn;
    conn.rawOutput = log;
    conn.rawInput = log;
});
});
$(document).bind("connected", function () {
    // inform the user
    Hello.log("Connection established.");
});

$(document).bind("disconnected", function () {
    Hello.log("Connection terminated.");
    // remove dead connection object
        Hello.connection = null;
});

function log(msg) {
console.log(msg);
}
function rawInput(data) {
    log("RECV: " + data);
    Hello.log("RECV: " + data);
}
function rawOutput(data) {
    log("SENT: " + data);
    Hello.log("SENT: " + data);
}

LOG

<body rid='3424369325' xmlns='http://jabber.org/protocol/httpbind' to='127.0.0.1' 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'/>

<body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams' from='localhost' authid='f8443751' sid='f8443751' secure='true' requests='2' inactivity='30' polling='5' wait='60' hold='1' ack='3424369325' maxpause='300' ver='1.6'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</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>

<body rid='3424369326' xmlns='http://jabber.org/protocol/httpbind' sid='f8443751'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/></body>

POST http://127.0.0.1:7070/http-bind/ 500 (Server Error)

我收到此500 Error。我有什么问题吗?

0 个答案:

没有答案
相关问题