0

我正在尝试创建一个客户聊天。我可以看到旁遮普服务器的日志为发送 - 接收。但从未显示为Strophes Connected 是否进行了以下设置

1)设置Xmpp服务器

wget -O openfire.deb http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_3.9.3_all.deb并按照https://www.digitalocean.com/community/tutorials/how 中所述完成设置 -to-install-openfire-xmpp-server-on-a-debian-or-ubuntu-vps 现在可以在 *****xmppserver.com 访问 openfire

2)在同一台服务器上设置Punjab Bosh Server 通过从github下载

https://github.com/twonds/punjab/blob/master/INSTALL.txt

并由 twistd -ny punjab.tac 开始运行

etc/hosts添加为

127.0.0.1 *****xmppserver.com

3)最后下载了最新的strophes.js并编辑了basic.js

var BOSH_SERVICE = 'http://*****xmppserver.com:5280/http-bind';

输出显示为正在连接,并且永远不会连接!

function onConnect(status) {
        console.log(status);
        if (status == Strophe.Status.CONNECTING) {
            log('Strophe is connecting.');
        } else if (status == Strophe.Status.CONNFAIL) {
            log('Strophe failed to connect.');
            $('#connect').get(0).value = 'connect';
        } else if (status == Strophe.Status.DISCONNECTING) {
            log('Strophe is disconnecting.');
        } else if (status == Strophe.Status.DISCONNECTED) {
            log('Strophe is disconnected.');
            $('#connect').get(0).value = 'connect';
        } else if (status == Strophe.Status.CONNECTED) {
            log('Strophe is connected.');
            log('Send a message to ' + connection.jid +
            ' to talk to me.');

            connection.addHandler(onMessage, null, 'message', null, null,  null);
            connection.send($pres().tree());
        }
    }

在此处输入图像描述

4

1 回答 1

0

您可以尝试使用 Openfire 内置的 BOSH http 连接管理器。在 Openfire 的管理面板上启用它:
Server > Server Settings > HTTP Binding,然后 BOSH URL 应该像

var BOSH_SERVICE = 'http://*****xmppserver.com:7070/http-bind/';

将 a/放在末尾/http-bind对 Strophe 至关重要。

于 2014-07-03T10:05:55.670 回答