libstrope 和 Strope jabber id、会话 id 和请求 id
对于 XMPP 即时消息,我使用 libstropice(C 库)在用户登录我的站点时自动创建连接。这发生在服务器端。然后在后续页面请求中我想再次使用该连接。我在网页的客户端使用 JavaScript Strope 库。 strope 有一个 Attach() 函数,它使用 jid、sid 并删除连接。 jid 是 jabber ID,sid 是会话 ID,rid 是请求 ID。请注意,Strope 还提供了一个 connect() 函数,我可以使用该函数获取 jid 和密码,但这速度较慢,并且迫使我将用户密码嵌入到页面上输出的 javascript 中。
我希望服务器端登录代码创建连接并将 jid、sid 和 rod 存储在 cookie 中。然后,在后续的页面请求中,只需读取 cookie 并将 jid、sid 和 Rid 传递给 Strope Attach() 函数即可。
听起来很容易吧?但是C中的libstropic在建立连接后不提供sid或rid?我发现如何通过发出某个“会话授权”节来获取 sid,但不知道如何摆脱?
我意识到这有点晦涩难懂。有帮助吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找的是预绑定;请参阅http://metajack.im/2009/12 /14/fastest-xmpp-sessions-with-http-prebinding/。
What you're looking for is pre-binding; see http://metajack.im/2009/12/14/fastest-xmpp-sessions-with-http-prebinding/.