Jump to content

Online/Offline status


plutomed

Recommended Posts

I have been thinking about this for a while now. What is the best way to see if someone is online? For example in Facebook chat people log on and off all the time and if no response after a while you get the "busy". I am creating an online games system and want to play with other computers. If someone goes inactive after say 30s I want to be able to detect this. The best way I have come up with is to ping a script every 30s to say the person is still online and if the person hasn't pinged in they are set to offline.

 

Is this the best way or does anyone have any better ideas?

Link to comment
Share on other sites

You can set up a table in your database that contains the user ID, and their last activity. Every time they load a page, you update this table with their last activity. When you want to check if they are online or not, you query this table to get the time of their last activity, and if it's been more than ___minutes (choose whatever time you think is appropriate), then they are offline, and if it's been less than that, they are online.

Link to comment
Share on other sites

you query this table to get the time of their last activity, and if it's been more than ___minutes (choose whatever time you think is appropriate), then they are offline, and if it's been less than that, they are online.

 

The same applies for setting them to busy.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.