0

Candy.js (v1.7.1) と Openfire v3.9.3 を使用しています。Candy パッケージに含まれているサンプルの index.html を実行すると、直接認証 (jid/pwd のブラウザー プロンプト) を使用しても問題はありません。ただし、サンプルを変更して Candy.Core.attach (Strophe.Connection.attach へのほぼパススルー) を使用するように変更すると、サーバー側の事前バインド (MatriX を使用) を実行した後、ある種のアイドル ループに陥ってしまうようです。空のメッセージを XMPP サーバーに 1 秒間に 3 回送信します。

このループの原因と、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 のデモでは、strophe.js が libs.bundle.js という大きなバンドルにラップされていることにも注意してください。

4

2 に答える 2

0

Openfire v3.9.3 BOSH の実装は「風変わり」のようです。MatriX の開発者は、この問題を回避することができました。MatriX v1.6.0.1 の時点で、このシナリオは解決されています。

于 2014-09-18T17:50:25.857 に答える
0

通常、BOSH 接続マネージャーに接続するとwait、最初のスタンザ (セッション作成要求) で属性を設定できます。

XEP-0124 セッション作成レスポンス

Strophe と Candy で使用されるデフォルト値は60です。BOSH セッションを確立するときに MatriX が使用している値を確認できますか?

元:

<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'/>
于 2014-09-17T18:37:05.813 に答える