Strophe无法连接到xmpp-server

时间:2014-01-14 10:44:51

标签: node.js xmpp strophe

我正在使用NodeJs xmpp-serverStropheJs构建应用程序。但是当strophe无法连接到xmpp-server时。这是日志:

Strophe is connecting.
Strophe failed to connect.
Strophe is disconnecting.
Strophe is disconnected.

这是我的js代码:

<script>
var connection=null;
$(function(){
    var conn = new Strophe.Connection('ws://192.168.2.198:5280/');
    conn.connect('quang.hoangqgs.com.vn', '123', function (status) {
        if (status == Strophe.Status.CONNECTING) {
            console.log('Strophe is connecting.');
        } else if (status == Strophe.Status.CONNFAIL) {
            console.log('Strophe failed to connect.');
            $('#connect').get(0).value = 'connect';
        } else if (status == Strophe.Status.DISCONNECTING) {
            console.log('Strophe is disconnecting.');
        } else if (status == Strophe.Status.DISCONNECTED) {
            console.log('Strophe is disconnected.');
            $('#connect').get(0).value = 'connect';
        } else if (status == Strophe.Status.CONNECTED) {
            console.log('Strophe is connected.');
            console.log('ECHOBOT: Send a message to ' + conn.jid +
                    ' to talk to me.');
        }else{
            console.log(status);
        }
    });
    connection = conn;
});
</script>

我在here中使用xmpp-server。 任何人都可以帮助我。感谢。

0 个答案:

没有答案