我正在尝试创建一个客户聊天。我可以看到旁遮普服务器的日志为发送 - 接收。但从未显示为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());
}
}