Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/403.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Strophe.js注册插件不工作_Javascript_Xmpp_Strophe - Fatal编程技术网

Javascript Strophe.js注册插件不工作

Javascript Strophe.js注册插件不工作,javascript,xmpp,strophe,Javascript,Xmpp,Strophe,我在远程位置托管了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

我在远程位置托管了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文档很糟糕。

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

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

试试上面的一个。

在strophe.register.js中转到第215行,按照下面的代码进行更改

 /*if (register.length === 0) {
            that._changeConnectStatus(Strophe.Status.REGIFAIL, null);
            return;
        } else */
this.enabled = true;
var connection = new Strophe.Connection("http://ip-address:5222/http-bind/");
试试上面的一个

var connection = new Strophe.Connection("http://ip-address:5222/http-bind/");
尾随斜杠需要在末尾


结尾需要用斜杠。

我对Strophe.js一无所知,但是否可以看到发送和接收XMPP节?看到这些可能会立即发现问题。诀窍是使用原始输入和原始输出+连接状态来确定服务器的实际情况。请看下面的代码:我必须警告您,我正在使用backbone.js和JOOP。我对Strophe.js一无所知,但是有可能看到发送和接收XMPP节吗?看到这些可能会立即发现问题。诀窍是使用原始输入和原始输出+连接状态来确定服务器的实际情况。请看下面的代码:我必须警告您,我正在使用backbone.js和JOOP。