【发布时间】:2017-09-29 12:24:06
【问题描述】:
我开始使用 converse js,首先,我使用的是 converse.js 3.2.1,对于 xmpp 服务器我使用的是 ejabberd 17.04,还有什么我想要的是:
在谷歌搜索和阅读文档方面付出了这么多努力,我得出的结论是我必须使用 keepalive、prebind、prebind url 并提供 jid,并且我必须添加服务器端预绑定,我发现了这个 xmpp library
但是当我尝试预绑定时,我遇到了某种错误:
致命错误: 未捕获的 XmppPrebindConnectionException:在服务器的响应中未找到子项。在 /var/www/html/converse.js/bind/lib/XmppPrebind.php:170 堆栈跟踪:#0 /var/www/html/converse.js/bind/bind.php(19):XmppPrebind->connect ('admin3@localhos...', 'xxxxxx') #1 {main} 在第 170 行的 /var/www/html/converse.js/bind/lib/XmppPrebind.php 中抛出
这是我的服务器端代码
$xmppPrebind = new XmppPrebind('localhost', 'http://localhost:5280/http-bind/', '5280', false, false);
$xmppPrebind->connect('admin3@localhost', 'xxxxx');
$xmppPrebind->auth();
$sessionInfo = $xmppPrebind->getSessionInfo(); // array containing sid, rid and jid
echo $sessionInfo;
这是我的 converse.init :
converse.initialize({
prebind: true,
prebind_url: "bind/bind.php",
allow_muc_invitations : true,
allow_logout: true,
jid : "admin3@localhost",
debug: true,
bosh_service_url: 'http://localhost:5280/http-bind/',
keepalive : true,
authentification: 'prebind',
prebind : true,
auto_list_rooms: true,
auto_subscribe: false,
hide_muc_server: false,
i18n: locales.id, // Refer to ./locale/locales.js to see which locales are supported
show_controlbox_by_default: true,
xhr_user_search: false,
play_sounds: true,
sounds_path : "http://localhost/converse.js/sounds/",
message_storage : 'local',
message_archiving: 'always',
default_domain : "localhost"
});
【问题讨论】:
标签: xmpp ejabberd converse.js