Also if anyone knows a diffrent way to see the online visitors (except pinging the server) please share.
crude way and very simple way of doing it (tried it out of interest)
iniate a timer, every ~5seconds run a script that updates a db with UTC time and sessionID. Add another hook on the timer checking DB for users active within the last 30seconds and return the results.
currently use this method in a crude chat app i built.
I am searching something that will use as little resources as possible. To make some kind of operation at every 5 seconds it's not a solution for me. I need that my application to sustain us much users as possible so i need to be carefully with the server resources.
do you need to know instantly if users log on/off or does the user check only need to check who's been active in the past 5minutes etc..., how accurate does it have to be?
what kind of user base are you looking at also?
my chat app also deals with message sending/receiving new messages every 0.5seconds on top of checks for users online/automatically setting some users as 'away' or 'busy', tested with ~60 users on a basic work machine using XXAMP and ran into 0 problems.
In the future i will also have a chat system in my application. Now i need to know very precise if the
user has opened the application (not using it - just if the appl is opened in the browser) and when he closes the appl. The method that i've chosed works perfectly in the first minutes but after that the destroyerlistener is not called. I sopose that the session is invalidated and the destroyer is not called (cause for now i don't have any activity on the consumer). I will try just for test to send at every 5 minutes a message to the consumer so i will see if this is the problem. Also i'm expecting thousands of users - this is the reason i don't want timer jobs.