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” :

"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 :

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.

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 :

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…

"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 !