0
votes

I have a strophe.js xmpp client, which connects to an ejabberd server running on the Amazon cloud. Since this is a strophe client, I have enabled bosh, and I can see it running at myAWSDNS.com:5280/http-bind/. I am able to connect to the server via my client using this bosh service, so it seems to functioning ok.

I would also like to add in-band registration, for which I use strophe.register.js

This is the code I use for this:

        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
        }
    });

If I step further into the code, this segment of code from strophe.js:

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

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

    var bodyWrap = req.getResponse();

bodyWraphas member outerHTML, which is

"<body xmlns="http://jabber.org/protocol/httpbind" type="terminate" condition="internal-server-error">BOSH module not started</body>"

So, BOSH module not started is the message.

Well, obviously I have the BOSH module started, otherwise I wouldnt be able to log into existing accounts and send things back and forth with this client. However, it is still complaining about this, so I am not sure if there is any additional steps I need to take to enable in-band registration via bosh.

For completeness, here are the relevant parts of ejabberd.cfg, first for bosh:

{5280, ejabberd_http, [
                         {request_handlers, [
             %% {["web"], mod_http_fileserver}
                {["xmpp-httpbind"], mod_http_bind}
             ]},
             captcha,
             http_bind, 
             http_poll, 
             web_admin
            ]}

 ]}.

and here for in-band registration:

  {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, ["[email protected]"]},

      {access, register}
     ]},

and, finally, the modules section:

    %%%   =======
%%%   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,[]},
1

1 Answers

1
votes

From what I can tell, the problem is not that the BOSH Module has not started (obviously it has), but your call to Strophe.register.connect() is providing a full URL for the domain parameter when it's expecting simply a domain. What you need to do is pass in myAWSDNS.com instead of a URL to connect().

Example:

tempConn.register.connect("myAWSDNS.com", ...);

Edit: Also, in your callback you're referencing your connection by connection where as outside of the callback you have defined tempConn.