We have implemented a JQuery chat in our company for internal communications. It is working fine. We are saving user status on data base, when a user logged in save his status on DB, when he logged out change status as log out.
Issue is that if any user does not click the logged out button and close the window or shut down his PC, he is still logged in our chat system.
How we can track if each user is logged in, possibly by tracking user session?
The best way (but not safest or most robust) I would think to accomplish this would be via cookies.
First, the server/jquery script would put a cookie on the computer which is removed when the browser session ends when the user logs in. Then when they log out, remove the cookie. So when you want to check if the user is logged in, you look for the cookie.