XMPP ejabberd带内注册:未启动接收xml BOSH,即使已启动

XMPP ejabberd带内注册:未启动接收xml BOSH,即使已启动,xmpp,ejabberd,strophe,Xmpp,Ejabberd,Strophe,我有一个strophe.js xmpp客户端,它连接到运行在Amazon云上的ejabberd服务器。因为这是一个strophe客户端,所以我启用了bosh,我可以在myAWSDNS.com上看到它在运行:5280/httpbind/。我可以通过我的客户机使用这个bosh服务连接到服务器,所以它似乎运行正常 我还想添加带内注册,为此我使用strophe.register.js 这是我使用的代码: var tempConn = new Strophe.Connection("htt

我有一个strophe.js xmpp客户端,它连接到运行在Amazon云上的ejabberd服务器。因为这是一个strophe客户端,所以我启用了bosh,我可以在myAWSDNS.com上看到它在运行:5280/httpbind/。我可以通过我的客户机使用这个bosh服务连接到服务器,所以它似乎运行正常

我还想添加带内注册,为此我使用strophe.register.js

这是我使用的代码:

        var tempConn = new Strophe.Connection("http//myAWSDNS.com:5280/http-bind/");
        tempConn.register.connect("http://myAWSDNS.com/", function (status) {
        if (status === Strophe.Status.REGISTER) {
            // fill out the fields
            connection.register.fields.username = "juliet";
            connection.register.fields.password = "R0m30";
            // calling submit will continue the registration process
            connection.register.submit();
        } else if (status === Strophe.Status.REGISTERED) {
            console.log("registered!");
            // calling login will authenticate the registered JID.
            connection.authenticate();
        } else if (status === Strophe.Status.CONFLICT) {
            console.log("Contact already existed!");
        } else if (status === Strophe.Status.NOTACCEPTABLE) {
            console.log("Registration form not properly filled out.")
        } else if (status === Strophe.Status.REGIFAIL) {
            console.log("The Server does not support In-Band Registration")
        } else if (status === Strophe.Status.CONNECTED) {
            // do something after successful authentication
        } else {
            // Do other stuff
        }
    });
如果我进一步深入代码,strophe.js中的这段代码:

    _register_cb: function (req) {
    var that = this._connection;

    Strophe.info("_register_cb was called");
    that.connected = true;

    var bodyWrap = req.getResponse();
Bodywrapas成员outerHTML,即

"<body xmlns="http://jabber.org/protocol/httpbind" type="terminate" condition="internal-server-error">BOSH module not started</body>"
在这里进行带内注册:

  {mod_register, [
      %%
      %% After successful registration, the user receives 
      %% a message with this subject and body.
      %%
      {welcome_message, {"Welcome!", 
                 "Welcome to this Jabber server."}},

      %%
      %% When a user registers, send a notification to 
      %% these Jabber accounts.
      %%
      %%{registration_watchers, ["admin1@example.org"]},

      {access, register}
     ]},
最后,模块部分:

    %%%   =======
%%%   MODULES

%%
%% Modules enabled in all ejabberd virtual hosts.
%%
{modules,
 [
  {mod_adhoc,    []},
  {mod_announce, [{access, announce}]}, % requires mod_adhoc
  {mod_caps,     []}, 
  {mod_configure,[]}, % requires mod_adhoc
  {mod_disco,    []},
  %%{mod_echo,   [{host, "echo.WIN-LV4K7BSUPJO"}]},
  {mod_http_bind,[]},
  {mod_register,[]},

据我所知,问题不在于BOSH模块没有启动(显然它已经启动了),而是您对
Strophe.register.connect()
的调用为
domain
参数提供了一个完整的URL,而它只需要一个域。您需要做的是传入
myAWSDNS.com
而不是
connect()
的URL

例如:

tempConn.register.connect("myAWSDNS.com", ...);
编辑:
另外,在您的回调中,您通过
connection
引用了您的连接,在回调之外,您已经定义了
tempConn

你好,Colton,谢谢您的回复。我想尝试一下你的解决方案,但不幸的是,我和ejabberd还有另一个可能无关的问题。每当我重新安装和配置ejabberd时,一段时间后,登录就不再起作用了。然后我重新安装,过了一会儿,登录再次中断。无限重复。无论如何,一旦我通过了,我会试试你的建议!谢谢:)好的,所以我无法找到ejabberd问题的根源(为什么它在一段时间后不断崩溃),所以我改为openfire 3.10.0 alpha。注册在那里也不起作用,但它显示出不同的行为,所以我在上提出了一个单独的问题,当然,我采纳了你的建议。谢谢你迄今为止的帮助!我想我刚刚注意到你的代码有另一个问题,请看我编辑的答案。我想你会有更好的运气与明火。。。也就是说,直到您开始遇到OF的内置BOSH连接管理器中的间歇性“客户端提供的无效SID”错误。
tempConn.register.connect("myAWSDNS.com", ...);