To replicate:
- Open two github tabs on which you're both logged in
- Log out of one tab.
- At the top of the 2nd tab you almost immediately get notification that you logged out on another tab
I've been trying to figure out how this works. Since the notification is almost immediate I considered 3 possibilities:
- Each tab makes XHR/AJAX requests on a schedule to check session validity with the server (or uses long polling)
- Each tab registers an event listener to Server Sent Events, and receives notification from the server upon logout.
- Each tab has a websocket connection to the server, and receives a similar notification.
For reference, these technologies are discussed here. I am stumped though because when I open the web browser's (Firefox 48 beta) network requests dev tool, I see no communication on the tab that shows the notification between the time I log out of the other tab, and the time the notification appears.
By the way, the notification works in the opposite direction as well. If you have two tabs logged out, and you log into one of them, a notification immediately pops up on the other tab that you logged in. What's going on?