2

我有自己的 xmpp 服务器。在:jenan.cz

为什么我无法通过 WebClient 连接?

错误:状态CONNFAIL

应用程序在这里:http: //jenan.cz/xmpp/

连接:http: //jenan.cz/xmpp/gab.js

我使用以下连接:

$(document).bind('connect', function (ev, data) {
    var conn = new Strophe.Connection(
        "http://jenan.cz:5280/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');
        } else if (status === Strophe.Status.ERROR) {
            alert ('status ERROR');
        } else if (status === Strophe.Status.CONNECTING) {
            alert ('status CONNECTING');
        } else if (status === Strophe.Status.CONNFAIL) {
            alert ('status CONNFAIL');
        } else if (status === Strophe.Status.AUTHENTICATING) {
            alert ('status AUTHENTICATING');
        } else if (status === Strophe.Status.AUTHFAIL) {
            alert ('status AUTHFAIL');
        } else if (status === Strophe.Status.ATTACHED);
            alert ('status ATTACHED');

    });

    Hello.connection = conn;
});
4

1 回答 1

0

在 ejabberd 中启用 http-bind 模块:

{modules,
 [
{mod_http_bind, [{max_inactivity, 120}]}
]}.

更改 5280 端口的设置:

  {5280, ejabberd_http, [
       {request_handlers,
         [
          {["http-bind"], mod_http_bind}
         ]},
       http_bind
       web_admin
       ]
    }

更改连接设置:

$(document).bind('connect', function (ev, data) {
    var conn = new Strophe.Connection(
        'http://jenan.cz:5280/xmpp-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');
        }

    });


    Gab.connection = conn;
});
于 2012-08-31T18:52:13.870 回答