开发者

libstrophe and Strophe jabber id, session id, and request id

For XMPP instant messaging, I am using libstrophe (C library) to automatically create a connection for my users when the login into my site. This happens on the server side. Then on subsequent page requests I want to use that connection again. I am using the JavaScript Strophe library on the client side for the web pages. strophe has an 开发者_运维问答attach() function which uses the jid, sid, and rid of the connection. jid is the jabber ID, sid is the session ID, and rid is the request ID. Note that Strophe also provides a connect() function that I could use that takes the jid and password, but this is slower and forces me to embed the users password into the javascript that is output on the page.

I want the server side login code to create the connection and store the jid, sid, and rid in a cookie. Then on subsequent page requests, its just a simple matter of reading the cookie and passing the jid, sid, and rid to the Strophe attach() function.

Sounds easy right? However libstrophe in C does not provide the sid or rid after you establish a connection? I found out how to get the sid by issuing a certain "session authorization" stanza, but have no idea how to get the rid?

I realize this is kind of obscure. Any help anyone?


What you're looking for is pre-binding; see http://metajack.im/2009/12/14/fastest-xmpp-sessions-with-http-prebinding/.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜