使用 eventmachine 捕获断开连接事件(ping + 超时?)
我正在使用带有 faye (http://faye.jcoglan.com/) 的事件机,但我有一个问题。我想制作一个在线模块,显示当前在我的网站上连接的所有用户。
我想创建一个像 google talk 这样的内容。
Faye 可能有更好的方法吗?
我这样管理我的连接:
Each user has his own channel like this /messages/<user_id>
但我的问题是,我如何捕获断开连接事件。我读到有关向我的彗星服务器发送 ping + 超时的内容,但我不知道该怎么做。
有人可以帮助我吗?
谢谢
I am using event machine with rails with faye (http://faye.jcoglan.com/) but i have a problem. I want to make a who is online module, showing all the users currently connected on my website.
I want to create a google talk like.
There is maybe a better way that Faye to do that?
I manage my connection like that :
Each user has his own channel like this /messages/<user_id>
But my question is, how can i catch a disconnect event. I read about send pings + timeout to my comet server but i don't know how to do this.
Anyone can help me?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 Faye 监控。您可以订阅
/meta/unsubscribe
或/meta/disconnect
频道。 Faye 处理客户端的检查/ping 和超时。Check out Faye Monitoring. You can subscribe to the
/meta/unsubscribe
or/meta/disconnect
channels. Faye handles the checking/pinging of the clients and the timeouts.