-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Description
I want to:
- report a bug
- request a feature
Current behaviour
The socket.on('disconnect') event on the client-side gets fired, when you leave the page in Firefox. Does not happen in Chrome.
I show an error modal when the socket looses its connection because I assume the server went down (not a rare scenario on an embedded device).
Navigating different pages, each with their own var socket = io(); and socket.on('disconnect') methods leads to unwanted flickering of error modals because the browser assumes for a split second that the server went down until the new page gets loaded.
Steps to reproduce (if the current behaviour is a bug)
See my fiddle fork: https://github.com/Tilogorn/socket.io-fiddle
I just added a second page and a link to it.
Open Chrome and navigate to index.html, open the console, check option "persist logs", then click on the link. Nothing special will appear:
Now do the same in Firefox. You will see the console.log statement of the disconnect listener.
Expected behaviour
Silently leaving the page. Or having a possibility to detect that the user and not the server closed the connection so no need to show an error modal. reason is transport close in both ways.
Setup
- OS: Linux Mint 19.3
- browser: Firefox 80.0 (observed), Chrome 84 (not observable)
- socket.io version: [email protected]

