我正在尝试使用strophe插件在openfire服务器上注册新用户,但无法连接进行注册。这里的描述https://github.com/metajack/strophejs-plugins/tree/master/register没有帮助我更进一步 :( 我需要在注册之前建立连接吗?这是我点击注册按钮时尝试的内容:
$("#RegButton").click(function () {
var callback = function (status) {
if (status === Strophe.Status.REGISTER) {
connection.register.fields.username = "juliet";
connection.register.fields.password = "R0m30";
connection.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
console.log("registered!");
connection.authenticate();
} else if (status === Strophe.Status.CONNECTED) {
console.log("logged in!");
} else {
// every other status a connection.connect would receive
}
};
connection.register.connect("http://localhost:7070/http-bind/", callback);
});