I have to know whether user is online or not, not current authenticated user, but any other. Does restful_authentication has some methods to determine it?
views:
16answers:
1
+2
A:
The only way to know if somebody is online (and viewing your site) is to have an open connection to her. But, after a page is loaded the HTTP connection to your server is closed, and the client does not talk to your server again until she wants to see another page.
Given this, you can do the following:
- Take a guess if the client is still there by assuming that she's "online" for x minutes after she has last requested a page.
- Have the client send a "heartbeat" to your server in regular intervals using Javascript, then apply 1.
- Actually have the client keep a persistent connection to your server using something like Comet, which will give you the most accurate result.
What's most appropriate depends on how accurate you need the status to be.
deceze
2010-08-07 04:20:36