I am developing a web-based game with a full user/account based system. One of the features I plan to add is a buddy list, where users can select other users as 'friends' or whatnot and then have them on a quickly accessibly buddy list for messaging, viewing game status, and inviting to games etc.
With that feature, I thought it would also be good to have a live list displayed of users from the buddy list who are currently online (much like phpBB or vbulletin shows the users currently signed in).
What's the most efficient way to manage a feature like this? Due to the nature of http, there's no true way for the script to know if a user is still there or not (from what I can tell), so I thought I would put a field in the user's table called 'last_seen' and timestamp it every time the user loads a page. Then, when the system checks who's online, it queries the user table for every user on your friends list and shows any of the ones who have been "last_seen" in the last 5 minute.
Can anyone suggest a better (less overhead or just better for whatever reason) method to handle this sort of feature?? Or does this sound reasonable.
Thanks