我在远程位置托管了Ejabberd服务器。我正在尝试使用Strophe.js注册插件注册新帐户,我找不到为什么这不起作用。下面是我写的代码
var connection = new Strophe.Connection("http://ip-address:5222/http-bind");
var callback = function (status) {
alert(Strophe.Status.REGISTER); // Returning me 10
if (status === Strophe.Status.REGISTER) {
alert("Entered");
connection.register.fields.username = "hello";
connection.register.fields.password = "hello";
connection.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
alert("registered!");
connection.authenticate();
} else if (status === Strophe.Status.CONNECTED) {
alert("logged in!");
} else {
// Sometimes execution entering into this block.
document.body.innerHTML = (JSON.stringify(status));
}
};
connection.register.connect("localhost", callback);任何额外的代码要添加到这个或任何修复,我必须做这个工作。请在这方面帮帮我。Strophe.js文档太糟糕了。
发布于 2014-04-01 17:54:10
在strophe.register.js中,转到第215行,并按照以下代码进行更改。
/*if (register.length === 0) {
that._changeConnectStatus(Strophe.Status.REGIFAIL, null);
return;
} else */
this.enabled = true;试试上面的一个。
发布于 2014-04-03 21:44:29
var connection = new Strophe.Connection("http://ip-address:5222/http-bind/");末尾需要使用尾随斜杠。
https://stackoverflow.com/questions/21157216
复制相似问题