Xmpp candy/strophe——使用预绑定(.attach)会导致紧密的空闲循环吗?

Xmpp candy/strophe——使用预绑定(.attach)会导致紧密的空闲循环吗?,xmpp,openfire,strophe,candy,Xmpp,Openfire,Strophe,Candy,我正在使用Candy.jsv1.7.1和OpenFirev3.9.3。运行Candy包中包含的示例index.html,使用jid/pwd的直接身份验证浏览器提示没有问题。但是,如果在执行服务器端预绑定uisng矩阵后,我将示例更改为使用Candy.Core.attach,几乎可以传递到Strophe.Connection.attach,那么我似乎陷入了某种空闲循环,每秒3次向XMPP服务器发送空消息 知道是什么导致了这种循环,以及为什么我使用Candy.Core.attach时,演示Candy

我正在使用Candy.jsv1.7.1和OpenFirev3.9.3。运行Candy包中包含的示例index.html,使用jid/pwd的直接身份验证浏览器提示没有问题。但是,如果在执行服务器端预绑定uisng矩阵后,我将示例更改为使用Candy.Core.attach,几乎可以传递到Strophe.Connection.attach,那么我似乎陷入了某种空闲循环,每秒3次向XMPP服务器发送空消息

知道是什么导致了这种循环,以及为什么我使用Candy.Core.attach时,演示Candy UI没有出现

修改样本

$(document).ready(function() {
    var httpbindUrl = 'http://xmpp.mydomain.net:7070/http-bind/';
    var chatRoom = 'testroom@conference.mydomain.net';

    // These values come from a REST call to our services that perform
    // the prebind authentication (using MatriX, obviously)
    var jid = 'someuser@mydomain.net/MatriX';
    var sid = 'b95ffa4';  // must be a string despite what candy's doc say
    var rid = 1983626985;

    Candy.init(httpbindUrl, {
        core: {
            debug: true,
            autojoin: [chatRoom]
        },
        view: { assets: './res/' }
    });

    Candy.Core.attach(jid, sid, rid); // this seems to cause some sort of looping to occur
    // Candy.Core.connect('someuser@mydomain.net', 'password'); // <-- this works as expected
    });
浏览器的控制台日志将显示

POST http://xmpp.mydomain.net:7070/http-bind/ [HTTP/1.1 200 OK 895ms]
POST http://xmpp.mydomain.net:7070/http-bind/ [HTTP/1.1 200 OK 491ms]
POST http://xmpp.mydomain.net:7070/http-bind/ [HTTP/1.1 200 OK 483ms]
"RECV: <body xmlns='http://jabber.org/protocol/httpbind' ack='1983626985'/>" candy.bundle.js:159
"LIBS:<1>: no requests during idle cycle, sending blank request" libs.bundle.js:1192
"LIBS:<0>: request id 4.0 posting" libs.bundle.js:1192
"LIBS:<0>: request id 4.0 state changed to 1" libs.bundle.js:1192
"SENT: <body rid='1983626986' xmlns='http://jabber.org/protocol/httpbind' sid='b95ffa4'/>" candy.bundle.js:159
POST http://xmpp.mydomain.net:7070/http-bind/ [HTTP/1.1 200 OK 436ms]
"LIBS:<0>: request id 4.1 state changed to 2" libs.bundle.js:1192
"LIBS:<0>: request id 4.1 state changed to 3" libs.bundle.js:1192
"LIBS:<0>: request id 4.1 state changed to 4" libs.bundle.js:1192
"LIBS:<0>: removing request" libs.bundle.js:1192
"LIBS:<0>: _throttledRequestHandler called with 0 requests" libs.bundle.js:1192
"LIBS:<0>: request id 4 should now be removed" libs.bundle.js:1192
"LIBS:<0>: request id 4.1 got 200" libs.bundle.js:1192
"LIBS:<1>: _dataRecv called" libs.bundle.js:1192
"RECV: <body xmlns='http://jabber.org/protocol/httpbind' ack='1983626986'/>" candy.bundle.js:159
"LIBS:<1>: no requests during idle cycle, sending blank request" libs.bundle.js:1192
"LIBS:<0>: request id 5.0 posting" libs.bundle.js:1192
"LIBS:<0>: request id 5.0 state changed to 1" libs.bundle.js:1192
"SENT: <body rid='1983626987' xmlns='http://jabber.org/protocol/httpbind' sid='b95ffa4'/>" candy.bundle.js:159
...continues in a similar pattern until I close the browser window.

注意:前面带有LIBS:的条目来自strophe的低级日志记录级别msg。还应该注意的是,candy demo将strophe.js打包成一个更大的包,名为libs.bundle.js。

通常,当您连接到BOSH连接管理器时,您可以在第一节会话创建请求上设置wait属性

Strophe和Candy使用的默认值为60。您能否确认在建立BOSH会话时矩阵使用的值

例:


OpenFireV3.9.3 BOSH的实现似乎“古怪”。矩阵开发人员能够解决这个问题。从MatriX v1.6.0.1开始,该场景已经解决。

我已经解决了,但上面的日志片段中没有显示。我会再检查一遍。确认。wait=60,hold=1,window=5您提到直接从客户端连接时一切正常,如果问题只在会话建立在服务器端时出现,是否可以查看MatriX发送的节日志?@fpsColton,我在这里问一个离题的问题。你有什么线索吗。我还需要获得用户昵称。或者有没有办法强制openfire及其相关插件在基于XEP-0172的首节中包含昵称。@UlukBiy,对不起,我没有给你任何建议。。在过去,我不得不求助于一些相当难闻的代码,以确定我是否被允许使用Openfire访问仅限成员的MUC,因为它根本无法满足我对成员列表的请求,即使XEP说应该这样做。我认为XMPP的任何实现都不是100%。请参见下面我的自我回答。
<body content='text/xml; charset=utf-8'
  from='user@example.com'
  hold='1'
  rid='1573741820'
  to='example.com'
  route='xmpp:example.com:9999'
  wait='60'
  xml:lang='en'
  xmpp:version='1.0'
  xmlns='http://jabber.org/protocol/httpbind'
  xmlns:xmpp='urn:xmpp:xbosh'/>