Wrox Programmer Forums
BOOK: Professional XMPP Programming with JavaScript and jQuery
This is the forum to discuss the Wrox book Professional XMPP Programming with JavaScript and jQuery by Jack Moffitt; ISBN: 978-0-470-54071-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XMPP Programming with JavaScript and jQuery section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 18th, 2011, 04:39 PM
Registered User
Join Date: Aug 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Strophe hangs after attaching

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:
conn.attach(Attacher.JID, Attacher.SID,parseInt(Attacher.RID,10)+1, function(status){	
Attached event code:
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

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.

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?
Old February 5th, 2012, 07:37 PM
Wrox Author
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts

It appears that JAXL increments the RID for you, so you'll want to use RID+0. That case seems to work in the logs you posted.

Similar Threads
Thread Thread Starter Forum Replies Last Post
BOSH, Strophe, and Openfire iowadeifan BOOK: Professional XMPP Programming with JavaScript and jQuery 11 March 31st, 2014 03:08 PM
Strophe Connection Error jpeterson7755 BOOK: Professional XMPP Programming with JavaScript and jQuery 1 February 28th, 2011 01:48 AM
Using sha1 passwords in Strophe.js semper BOOK: Professional XMPP Programming with JavaScript and jQuery 1 June 28th, 2010 02:15 PM
localhost - hangs Gardener Classic ASP Basics 2 July 14th, 2004 04:42 PM
My Program Hangs! zaimi Visual C++ 1 May 21st, 2004 06:34 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.