A
A
Alexander Kouznetsov2014-02-18 14:46:43
Google Chrome
Alexander Kouznetsov, 2014-02-18 14:46:43

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

2 answer(s)
M
mayorovp, 2014-02-19
@mayorovp

Why the hell is this close even needed? Catch a disconnect. You still need to catch it anyway.

V
Vyacheslav Ruzanov, 2014-04-28
@ruzslav

Also faced the same problem. I use this crutch

window.onunload = function(){
    ws.close();
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question