admin管理员组文章数量:1391934
I'm having a lot of difficulty getting strophe's 'attach()' function working.
I am working on a social network where users will be surfing pages and at the same time keep their chat connection on. I don't want to reconnect/reauthorize on every page so as per this link, ;fwc=1, i am storing the SID and RID into a cookie onunload.
On the next page when i try to use the new SID and RID (after incrementing it by 1) my session is already destroyed. Ejabberd reports "Error on HTTP put. Reason: bad_key"
WTF is happening?
I'm having a lot of difficulty getting strophe's 'attach()' function working.
I am working on a social network where users will be surfing pages and at the same time keep their chat connection on. I don't want to reconnect/reauthorize on every page so as per this link, http://groups.google./group/strophe/browse_thread/thread/430da5e788278f3a/93c48c88164f382f?show_docid=93c48c88164f382f&fwc=1, i am storing the SID and RID into a cookie onunload.
On the next page when i try to use the new SID and RID (after incrementing it by 1) my session is already destroyed. Ejabberd reports "Error on HTTP put. Reason: bad_key"
WTF is happening?
Share Improve this question edited Apr 8, 2011 at 13:26 Dirk 1,2347 silver badges22 bronze badges asked Apr 11, 2010 at 8:18 AdilAdil 2,1124 gold badges27 silver badges37 bronze badges2 Answers
Reset to default 6Without more logging information from ejabberd or Firebug, this will be hard to diagnose. Is the correct RID actually stored in the cookie? What does ejabberd think is the last stanza you sent, and what RID value does it have? What is the first stanza and the first RID value on the new page? How long between those two stanzas?
Updated: The reason the session gets canceled is due to the security model of BOSH. Effectively, the SID and RID pair are secret. If you know the pair, you can attach to the session. In order to keep people form being able to guess, the RID is picked randomly from a very large space. If you send an RID outside a very small window from the current RID, it will disconnect the session. The window is usually (RID, RID + 5) or so.
I managed to solve the problem.
The rid was being double incremented between the page loads. By incrementing it only once the session attach started working.
I don't know why the session got cancelled, but here's what happened :
- Because the RID is +2 more than the previous ones, ejabberd stores the request in buffer and does not forward it to clients
- The next 2 requests also get stored
- The one after that causes ejabberd to cancel the session
Any clues?
本文标签: javascriptSession resume problem with Strophe attach and EjabberdStack Overflow
版权声明:本文标题:javascript - Session resume problem with Strophe attach and Ejabberd - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744705880a2620840.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论