0
votes

I previously asked a similar question about ejabberd, however ejabberd was giving other problems, so I switched to openfire. For the sake of not making the original qestion to cluttered, I decided to create a new question, since this question pertains to openfire and is a different issue than the one I was having with ejabberd.

So, here goes the question:

I have a strophe.js xmpp client, which connects to an openfire 3.10.0 alpha server running on the Amazon cloud. I need 3.10.0 alpha over 3.9.3 because of a bfix which is included in the former, but not the latter.Anyway, since this is a strophe client, I have enabled bosh, and I can see it running at myAWSDNS.com:7070. I am able to connect to the server via my client using this bosh service and existing accounts, and send messages back and forth so it seems to be 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:7070/http-bind/");
    tempConn.register.connect("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
    }
});

This seems to work fine, as it enters the first if-bracket (status === Strophe.Status.REGISTER), and tries to set connection.register.fields.username = "juliet";

However, here, when executing that line, it jumps into strophe.js line 2476:

if (this.connect_callback) {
        try {
            this.connect_callback(status, condition);
        } catch (err) {
            Strophe.error("User connection callback caused an " +
                          "exception: " + err);
        }
    }

where 2476 is the code in the catch(err) { ...... } bracket.

If I inspect err, this is what I get: enter image description here

So message: connection is not defined and, obviously, the regstration doesnt work, and I am not sure why. Does anyone have any input on this?

Thanks, and best regards,

Chris

1

1 Answers

2
votes

You might not like this answer... The reason for connection == undefined is because you named it tempConn.