I'm making a chat web app. Just found out that if user closes the tab or browser directly without clicking 'logout' button, the state in database will still show "online". So how to logout user when browser or tab is closed? I'm using COOKIE instead of session. I searched a lot in stack overflow, didn't find a working solution.
Anyone can help me? Thanks in advance!