"Users browsing this forum" question

How does PHP BB know who's browsing? Or, more accurately, who's still browsing?
It's easy enough to know who is visiting a certain forum: whatever usernames load the page. But how does it know when someone leaves? I suppose if someone visits another part of the site. But how does it know when someone just shuts down their browser or goes elsewhere on the web? Does it take their name off after X minutes of inactivity?
Always wondered this.
It's easy enough to know who is visiting a certain forum: whatever usernames load the page. But how does it know when someone leaves? I suppose if someone visits another part of the site. But how does it know when someone just shuts down their browser or goes elsewhere on the web? Does it take their name off after X minutes of inactivity?
Always wondered this.