通过Bosh进行的Openfire带内注册不适用于Strophe/Strophe.register.js [英] Openfire in-band-registration via Bosh not working with Strophe/Strophe.register.js

查看:154
本文介绍了通过Bosh进行的Openfire带内注册不适用于Strophe/Strophe.register.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前曾问过一个关于

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.

所以,问题来了:

我有一个strophe.js xmpp客户端,该客户端连接到在Amazon云上运行的openfire 3.10.0 alpha服务器.由于前者中包含了一个bfix,但我不需要3.0.0,因此我需要3.10.0 alpha超过3.9.3.无论如何,因为这是一个strophe客户端,所以我启用了bosh,并且可以在myAWSDNS.com上看到它运行:7070.我可以使用此Bosh服务和现有帐户通过客户端连接到服务器,并来回发送消息,因此看起来工作正常.

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.

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

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

这是我用于此的代码:

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

这似乎很好用,因为它进入了第一个if括号(status === Strophe.Status.REGISTER),并尝试设置connection.register.fields.username = "juliet";

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";

但是,在这里,执行该行时,它会跳到strophe.js第2476行:

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

其中2476是catch(err) { ...... }括号中的代码.

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

如果我检查err,这就是我得到的:

If I inspect err, this is what I get:

所以消息:connection is not defined,显然,该注册不起作用,我不确定为什么.有人对此有任何意见吗?

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?

谢谢,最好的问候,

克里斯

推荐答案

您可能不喜欢此答案... connection == undefined的原因是因为您将其命名为tempConn.

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

这篇关于通过Bosh进行的Openfire带内注册不适用于Strophe/Strophe.register.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆