Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > BOOK: Professional XMPP Programming with JavaScript and jQuery
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 18th, 2011, 04:39 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Strophe hangs after attaching

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
  #2 (permalink)  
Old February 5th, 2012, 07:37 PM
Wrox Author
Points: 702, Level: 10
Points: 702, Level: 10 Points: 702, Level: 10 Points: 702, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:12 AM.


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