MyBB Community Forums

Full Version: How does MyBB detect if a user is online or offline?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, i've noticed that MyBB can immediately detect if a user is online or offline. I was wondering how it does this and where is this function located in the source? I'm assuming it uses some sort of Jquery to ping the user every now and then to make sure he's still online?
The online/offline is actually a rough estimation based on their activity within a period of time that can be set in the ACP (Cut-off Time, 15 minutes by default). Every time a user visits or refreshes a page while being logged in, a timestamp is being saved, which is then compared to the current time. If the last action was within the specified time frame he is considered online. There are no asynchronous pings involved; additionally, users that have chosen not to be shown on the Who's online list always appear as offline.
Wow ok. I was not aware. I noticed that once I close out of my tab, I'll instantly be appearing as offline. I know you are staff, but that seemed really quick for it not to have a ping used.