如何检测 Strope.js 断开连接的会话?
假设聊天对话时间较长,Jabber 聊天客户端之间的连接可能最终会断开。
如何检测来自基于 Strope.js 的 jabber 客户端的连接?
Assuming long chat conversations, the connection between Jabber chat clients is likely to get disconnected eventually.
How does one go about detecting that a connection from a Strophe.js based jabber client?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Strope 通过事件管理连接状态变化。似乎没有简单的方法来查询给定连接的状态,但跟踪它相当简单。
Strope.Connection 上的“连接”消息采用一个函数,然后在任何连接状态更改时都会调用该函数。跟踪该功能内的当前状态。
Strophe manages connection status changes through events. There appears to be no easy way to query the status of a given connection, but it's fairly straight forward to keep track of it.
The "connect" message on a Strophe.Connection takes a function, which will then be called on any connection status change. Keep track of current status within that function.