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.
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.