listing online users

Hello,

I need to list all of the users currently logged into my application. I've dug around and it looks like the best approach is to use database based sessions and query the session table.

Is the best way? I assume I'll have to handle users that have closed their browser where their session hasn't expired. Are there any other issues I'll need to be aware of?

Thanks, Dan