【问题标题】:i have problems with xmpp serverside binding with fatal error我遇到了 xmpp 服务器端绑定的问题,出现致命错误
【发布时间】:2017-09-29 12:24:06
【问题描述】:

我开始使用 converse js,首先,我使用的是 converse.js 3.2.1,对于 xmpp 服务器我使用的是 ejabberd 17.04,还有什么我想要的是:

  1. 登录converse js获取jid值
  2. 在浏览器中保持会话活动(无论何时关闭或刷新)
  3. 添加一些可以破坏会话的注销

在谷歌搜索和阅读文档方面付出了这么多努力,我得出的结论是我必须使用 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


    【解决方案1】:

    在同一个异常上停留了几个小时,经过大量挖掘,我用下面提到的库替换了 Xmpp 库,它对我来说就像魅力一样。

    https://github.com/turalus/XMPP-Prebind-for-PHP

    同样用

    替换相反的初始化
     jid : "admin3"    //just username without hostname as your library will concatenate it for you
     bosh_service_url: 'http://localhost:5280/bosh/'    //the updated ejabberd bosh url
    

    休息看起来不错。

    【讨论】:

      猜你喜欢
      • 2021-03-20
      • 1970-01-01
      • 2014-01-27
      • 1970-01-01
      • 2017-12-31
      • 1970-01-01
      • 2014-05-10
      • 2015-12-11
      • 1970-01-01
      相关资源
      最近更新 更多