我尝试使用 strophe-register-plugin ( https://github.com/metajack/strophejs-plugins/tree/master/register ) 注册一个 xmpp 帐户。它适用于示例“ http://bosh.metajack.im:5280/xmpp-httpbind ”中的连接管理器,但我无法使用 OpenFire 连接管理器注册帐户。(正常登录适用于两个连接管理器......)
连接状态变化是 1 -> 10,就是这样。1 表示“连接”,但我不知道 10 是什么意思...
var connection = new Strophe.Connection(
// "http://bosh.metajack.im:5280/xmpp-httpbind");
"http://localhost/http-bind");
var callback = function (status) {alert(status);
if (status === Strophe.Status.REGISTER) {
connection.register.fields.username = "fghdfhg";
connection.register.fields.name = "dfgfdgfdg";
connection.register.fields.password = "dfddfgfdg";
connection.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
console.log("registered!");
connection.authenticate();
} else if (status === Strophe.Status.CONNECTED) {
$(document).trigger('connected');
} else if (status === Strophe.Status.DISCONNECTED) {
console.log("Disconnected from XMPP-Server");
}
};
// connection.connect(data.jid, data.password, callback);
connection.register.connect("xyz.com", callback, 60, 1);