on Rails的在线用户在Ruby中 [英] Online users in Ruby on Rails

查看:168
本文介绍了on Rails的在线用户在Ruby中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是最简单的方法如何检查,如果用户是在线用户的在线和显示列表?

What is the simplest way how to check if user is online and display list of online users?

我能想到的唯一的办法就是一些定期轮询服务器更新的最后一个动作时戳的,当最后一个时间戳超过XX前,用户被认为是脱机。但它似乎并不像太eficient解决方案。

The only way I can think of is some periodic polling server to update last action timestamp, and when last timestamp is more than xx ago, user is considered to be offline. But it doesn't seem like too eficient solution.

推荐答案

Authlogic 可以在默认情况下做到这一点,是一个伟大的认证系统是非常强大的。我建议您迁移现有的认证系统移交给它(可能是价值数天,这取决于如何定制你的系统)。

Authlogic can do this by default, and is a great authentication system that is very powerful. I would suggest migrating your current authentication system over to it (maybe a days worth of work, depending how customized your system is).

如果你不能(或者根本就不想),将您的应用程序交给Authlogic,你可以检查出源$ C ​​$ C在上面的链接,以及一个示例项目的here

If you can't (or simply don't want to) move your application over to Authlogic, you can check out the source code at the link above, as well as an example project here.

这篇关于on Rails的在线用户在Ruby中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆