Answer the question
In order to leave comments, you need to log in
Should the browser generate WebSocket.close() when the page closes?
Actually, the question is in the subject. I did not find it in the w3c specification, maybe I was looking in the wrong place.
Interested in whether work with websockets from the browser side is regulated somewhere when closing a page that has active connections.
The question arose from the fact that IE and FF send Close to the server when closing a tab, but Chrome doesn’t (and if the browser is completely closed, it doesn’t either).
Answer the question
In order to leave comments, you need to log in
Why the hell is this close even needed? Catch a disconnect. You still need to catch it anyway.
Also faced the same problem. I use this crutch
window.onunload = function(){
ws.close();
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question