javascript - Strope.js 注册插件不起作用

标签 javascript xmpp strophe

我在远程位置托管了 Ejabberd 服务器。我正在尝试使用 Strope.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);

要添加到此的任何额外代码或我必须做的任何修复才能使此工作正常进行。请帮我解决这个问题。 Strope.js 文档很糟糕。

最佳答案

strope.register.js中,转到第215行并按照以下代码进行更改。

 /*if (register.length === 0) {
            that._changeConnectStatus(Strophe.Status.REGIFAIL, null);
            return;
        } else */
this.enabled = true;

尝试上面的一个。

关于javascript - Strope.js 注册插件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21157216/

相关文章:

php - 从查询字符串php中删除加号

javascript - Bootstrap 列没有并排出现并且宽度都相同

ios - XMPP 上次事件时间以奇怪的形式显示。如何解决?

javascript - 替换功能只能使用一次(javascript)

javascript - jQuery:在 not 和 CSS 的多个选择器方面遇到麻烦

javascript - 在 xmpp 群聊中发送聊天标记

java - 用于客户端通知的 AMQP 或 XMPP

javascript - 如何在xmpp服务器中创建新组

javascript - 收到 Strope.js 通知(正在撰写)

mysql - 我们如何在 MySQL 数据库中存储聊天对话? XMPP 开火