How do I know that the server on socket.io is not available, if I enclose my code in a try catch, this construct does not work. The socket.on(disconnect, function(){...}) event socket.on(disconnect, function(){...}) triggered only if the server is turned off while the client is running, but if the server was not started or unavailable before the page was opened, then this event does not fire. How to know that the server is not running from the client?
|
disconnecthaserror,reconnect_error,reconnect_failedevents. Depending on the settings, use the appropriate event. - Alex Krasssocket.on('error', () => {}),socket.on('reconnect_error', () => {}),socket.on('reconnect_failed', () => {})do not work ? - Vasily Barbashevconnect_errortry - Vasily Barbashev