Hello,
I found the book amazing to read! Even the sections I did not have any initial interest in were fun to read.
I got the book because I was told to make a chat program for our website. I was limited to php/javascript so I used the JAXL library to initiate my BOSH connection with my server. The connection is made, the JID, SID, and RID are all passed on to my client's side and I use strophe's attach mechanism to attach to the session.
The issue is that once connected, if I use the RID incremented by one, I connect, but then I go to retrieve the roster and strophe hangs on sendIQ. I have trace statements above and below the sendIQ call and those beyond the sendIQ call are never reached. But there is an active connection with the server.
Attach code:
Code:
conn.attach(Attacher.JID, Attacher.SID,parseInt(Attacher.RID,10)+1, function(status){ if(status===Strophe.Status.ATTACHED||status===Strophe.Status.CONNECTED){$(document).trigger('attached');
}
Attached event code:
Code:
$(document).bind('attached',function(){var iq = $iq({type:'get'}).c('query',{xmlns:'jabber:iq:roster'});
$('body').append("<span>Attached. Sending IQ</span>"); //first trace
qjChat.connection.sendIQ(iq,qjChat.on_roster); //hangs here
$('body').append("<span>IQ sent!</span>"); //never reached
qjChat.connection.addHandler(qjChat.on_roster_changed,"jabber:iq:roster","iq","set");
qjChat.connection.addHandler(qjChat.on_message, null, "message", "chat");
});
The only traffic between the server and the client are simple keepalive messages:
HTML Code:
<body rid='9123' xmlns='http://jabber.org/protocol/httpbind' sid='497a1de6afc84418517a706ef552a1ccd8e81d7b'/>
If I change the RID to be anything other than +1, the following happen:
+2: error out with item_not_found
0:
HTML Code:
<body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' from='my.server.url' id='8'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq></body>
Then it returns to idle messages.
-1:
HTML Code:
<body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' id='a' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>test1@my.server.url/jaxl.1.1313699588</jid></bind></iq></body>
Then it repeats 0 and then 1.
-2: errors out with item-not-found.
Any ideas as to why I can't do something as trivial as latching onto sessions?
Niels