When I intentionally shut down a web sockets server the client JavaScript code:
try
{
self.socket.send('ping');
}
catch(ex)
{
console.log('exception');
}
writes in Chrome console:
WebSocket is already in CLOSING or CLOSED state.
This exception couldn't be caught by try-catch. How to detect for sure that data could not be sent through web socket? onclose event is not being fired.