I am trying to develop a chat application and I need to know whether the other user is active or not.I already went through "timestamp" example( if the last activity is more than specified time consider the user as offline ) and the problem with this method is that this code need to executed repeatedly in regular intervals through javascript.
So, I was thinking that if there is any way to check whether a sessions is active or not in server by knowing the session ID.If this is possible I am making an extra column for "last session id" in MYSQL table and I will check if it is active or closed the every time I send a message and I can know for sure if the person on the other side is active or not.