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 March 6th, 2012, 12:49 PM
Registered User
 
Join Date: Mar 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem to attach (StropheJS/OpenFire)

Hi,

I am actually developping a script in order ton show two types of web chats : multi-users and 1to1 chat.

For the 1to1 chat, it's like Facebook : a minichat in the footer of the screen, a contact list, discussions that are opened when we receive a message, etc...

All is working perfectly, but actually if I reload the page with an auto login (with connect), I have sometimes (1 time for 2 refreshs) "SID errors" :

Code:
"NetworkError: 404 Invalid SID. - http://localhost:6969/http-bind/"
So I would like to keep the connexion alive from a page to an other, like on Facebook. So in the unload event of the page, I created cookies in order to save the SID, JID and RID of the connection :

Code:
naim_object.connection.pause();

$.cookie("naim_minichat_sid",naim_object.connection.sid,{path:"/"});
$.cookie("naim_minichat_jid",naim_object.connection.jid,{path:"/"});
$.cookie("naim_minichat_rid",naim_object.connection.rid,{path:"/"});
In login function of my minichat, I added a verification of the cookies, and if the cookies exists I call attach(), else I call connect() with the user informations.

Code:
if($.cookie("naim_minichat_sid") != null && $.cookie("naim_minichat_jid") != null && $.cookie("naim_minichat_rid") != null){

// Attach

}else{

// Connect

}
For the attach() case, I increment the RID and do the attach :

Code:
this.connection.attach($.cookie("naim_minichat_jid"),$.cookie("naim_minichat_sid"),(parseInt($.cookie("naim_minichat_rid")) + 1),function(status){

console.log(status);

}
The thing is that the status 8 is called (ATTACHED), with no error, but I can't receive any connection from the server. When a user send a message to me, I don't receive anything.

And the HTTP connection fail...

Code:
"NetworkError: 404 Invalid SID. - http://localhost:6969/http-bind/"
I am doing something wrong ?

I am defenitly no able to keep these connections alive...

Thank you for your answers !





Similar Threads
Thread Thread Starter Forum Replies Last Post
Hello example connected user is always offline in openfire babyfool BOOK: Professional XMPP Programming with JavaScript and jQuery 3 August 21st, 2014 09:56 AM
Chapter 10 Netpad with Openfire? Raiser BOOK: Professional XMPP Programming with JavaScript and jQuery 2 July 21st, 2014 12:40 PM
BOSH, Strophe, and Openfire iowadeifan BOOK: Professional XMPP Programming with JavaScript and jQuery 11 March 31st, 2014 03:08 PM
Openfire and xmpp:restart sarahgt BOOK: Professional XMPP Programming with JavaScript and jQuery 1 February 5th, 2012 08:10 PM
Connection configuration to local openfire server Purushotham BOOK: Professional XMPP Programming with JavaScript and jQuery 0 August 1st, 2011 02:10 AM





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