0

I'm using Candy.js (v1.7.1) and Openfire v3.9.3. Running the sample index.html included in the Candy package, I have no issues using direct authentication (browser prompts for jid/pwd). However, if I change the sample to use Candy.Core.attach (nearly a pass-thru to Strophe.Connection.attach) after performing a server side prebind (uisng MatriX), I seem to get stuck in some sort of idle loop that blasts empty messages to the XMPP server 3x a second.

Any ideas what is causing this looping and why the demo Candy UI doesn't appear when I use Candy.Core.attach?

Modified sample...

$(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
    });

The browser's console log displays...

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.

NOTE: Entries prepended with "LIBS:" are from strophe's low-level logging (level, msg). It should also be noted that the candy demo wraps strophe.js into a larger bundle called libs.bundle.js.

Tony
  • 1,986
  • 2
  • 25
  • 36

2 Answers2

0

Normally when you connect to a BOSH connection manager you have the ability to set the wait attribute on your first stanza (session creation request).

XEP-0124 Session Creation Response

Default value used by Strophe and Candy is 60. Can you confirm the value which MatriX is using when establishing your BOSH session?

Ex:

<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'/>
fpsColton
  • 873
  • 5
  • 11
  • I have but it isn't shown in the log snippet above. I'll double check. – Tony Sep 17 '14 at 21:21
  • Confirmed. wait=60, hold=1, window=5 – Tony Sep 17 '14 at 21:27
  • You mentioned that everything works fine when you connect directly from the client side, if the problem only occurs when the session is established server side, would it be possible to view a log of the stanza's sent from MatriX? – fpsColton Sep 17 '14 at 21:55
  • @fpsColton, I am asking an off topic here. Do you have any clues on [this question](http://stackoverflow.com/questions/17145899/get-members-nickname-of-muc-room). I need also to get the user nickname. Or is there a way to force openfire (and its related plugin) to include nickname in initial stanzas based on XEP-0172. – Uluk Biy Sep 18 '14 at 04:24
  • @UlukBiy, Sorry I haven't got any advice for you.. I've had to resort to some fairly smelly code in the past just to find out if I'm allowed access into a member-only MUC with Openfire because it simply won't fulfil my request for a member list (even though the XEP says it should). I don't think any implementation of XMPP is 100%. – fpsColton Sep 18 '14 at 15:44
  • See my answer. MatriX had to made a code change to work around an issue with Openfire. – Tony Sep 18 '14 at 17:51
  • Ah nice find, strange that I haven't heard of this issue. Updating to 3.9.3 didn't introduce any new problems for me. Since more people will surely encounter this you should mark your answer as accepted. – fpsColton Sep 18 '14 at 19:21
0

It seems Openfire v3.9.3 BOSH implementation is 'quirky'. MatriX developers were able to work around the issue. As of MatriX v1.6.0.1 the scenario is resolved.

Tony
  • 1,986
  • 2
  • 25
  • 36