Xmpp Openfire通过Bosh进行带内注册不使用Strophe/Strophe.register.js
我之前问过一个类似的问题,但是ejabberd提出了其他问题,所以我转向openfire。为了不让原来的qestion变得杂乱无章,我决定创建一个新问题,因为这个问题与openfire有关,与我与ejabberd讨论的问题不同 所以,问题来了: 我有一个strophe.js xmpp客户端,它连接到运行在Amazon云上的openfire 3.10.0 alpha服务器。我需要3.10.0 alpha而不是3.9.3,因为前者包含bfix,但后者不包含bfix。无论如何,由于这是一个strophe客户端,我已经启用了bosh,我可以在myAWSDNS.com:7070上看到它正在运行。我能够通过我的客户机使用这个bosh服务和现有帐户连接到服务器,并来回发送消息,使它看起来运行正常 我还想添加带内注册,为此我使用strophe.register.js 这是我使用的代码:Xmpp Openfire通过Bosh进行带内注册不使用Strophe/Strophe.register.js,xmpp,registration,openfire,strophe,Xmpp,Registration,Openfire,Strophe,我之前问过一个类似的问题,但是ejabberd提出了其他问题,所以我转向openfire。为了不让原来的qestion变得杂乱无章,我决定创建一个新问题,因为这个问题与openfire有关,与我与ejabberd讨论的问题不同 所以,问题来了: 我有一个strophe.js xmpp客户端,它连接到运行在Amazon云上的openfire 3.10.0 alpha服务器。我需要3.10.0 alpha而不是3.9.3,因为前者包含bfix,但后者不包含bfix。无论如何,由于这是一个stroph
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”代码>
但是,在这里,当执行该行时,它跳转到strophe.js第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){……}
括号中的代码
如果我检查err
,我得到的是:
所以消息:连接没有定义,很明显,注册表不起作用,我不知道为什么。有人对此有什么意见吗
谢谢,并致以最良好的问候
克里斯你可能不喜欢这个答案。。。connection==undefined
的原因是因为您将它命名为tempConn
我不喜欢或不喜欢它,我不理解它。tempConn是某种保留名称吗?所以你是说我只需要给它取个别的名字?哦,哎呀,我想我明白了,哈哈哈,这可能是阻止你尝试与Ejabbard合作的原因。另外,别忘了将答案标记为已接受,干杯!是的,我会看看ejabberd是否也能正常工作,尽管我确实有一些与乐队注册无关的奇怪行为。谢谢你的帮助!