Strophe attach() function not working
I am trying to use Strophe.js attach function after a subsequent call to connect. So basically I am using connect on say the first page load. Then when the page unloads, I get the jid, sid, and rid (jabber ID, session ID, reques开发者_如何转开发t ID) from the Strophe connection object and store it in a cookie. Then on subsequent page loads I read the cookie and call the attach function.
But the Strophe attach function doesnt seem to actually be working because both connect and attach should then trigger a bunch of further Strophe calls. As I said connect works fine, attach just seems to return a status of attached, but is the session actually being restored.
Pseudocode:
read_cookie()
if cookie was valid:
use connect( jid, password )
else:
use attach( jid, sid, rid )
on_page_unload( write_cookie() )
Any ideas what I am doing wrong. If metajack (author of Strophe) happens to read this, please create better documentation and provide a simple example of using the attach function.
Attach and Connect will trigger different XMPP calls, connect will perform the whole authentication process while attach will simply return the code attached without performing authentication process again (that's the beauty of attach). So your application is working normal, can you explain what is the real problem, i.e. on Attach session is destroyed or etc..??
精彩评论