I wanted to know how facebook chat works when any user closes the browser without loggingout.
How does FB know that window is closed and send the message to the inbox and do not attempt to show the ping?
I wanted to know how facebook chat works when any user closes the browser
Share
Facebook / GTalk and any other online chat client usually uses a ‘ping’ or check to see if the user is still online / using the window. You can do this easily by firing off a Ajax call in the background every 1-2 minutes.
Every time the ajax call is made, update the
last_seentime in your database. If the date / time exceeds 1-2 minutes (as per your ajax call), you know the user has closed the browser or lost their connection.