首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Strophe.js寄存器插件不工作

Strophe.js寄存器插件不工作
EN

Stack Overflow用户
提问于 2014-01-16 16:55:33
回答 2查看 732关注 0票数 0

我在远程位置托管了Ejabberd服务器。我正在尝试使用Strophe.js注册插件注册新帐户,我找不到为什么这不起作用。下面是我写的代码

代码语言:javascript
复制
    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文档太糟糕了。

EN

回答 2

Stack Overflow用户

发布于 2014-04-01 17:54:10

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

代码语言:javascript
复制
 /*if (register.length === 0) {
            that._changeConnectStatus(Strophe.Status.REGIFAIL, null);
            return;
        } else */
this.enabled = true;

试试上面的一个。

票数 2
EN

Stack Overflow用户

发布于 2014-04-03 21:44:29

代码语言:javascript
复制
var connection = new Strophe.Connection("http://ip-address:5222/http-bind/");

末尾需要使用尾随斜杠。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21157216

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档