views:

16

answers:

1

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?

+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:

  1. 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.
  2. Have the client send a "heartbeat" to your server in regular intervals using Javascript, then apply 1.
  3. 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