Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome : websocket connection not closed when browser closed

I am using Netty websockets and everything seems to work fine except this minor issue :

If I close the browser / tab of the js websocket client , the websocket connection is automatcally closed when using Mozilla firefox (currently using firefox 14) but the same thing does not happen in Chrome 20/21.

Anyone seen a similar issue / can anyone tell why is the connection not closed automatically ?

like image 514
Rndm Avatar asked Aug 01 '12 08:08

Rndm


People also ask

How do I turn off WebSockets in Chrome?

close() The WebSocket. close() method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED , this method does nothing.

Does WebSocket keep connection open?

WebSockets keeps a single, persistent connection open while eliminating latency problems that arise with HTTP request/response-based methods. WebSockets generally do not use XMLHttpRequest, and as such, headers are not sent every-time we need to get more information from the server.

How long does WebSocket connection stay open?

However, the connection between a client and your WebSocket app closes when no traffic is sent between them for 60 seconds.

When WebSocket connection is closed?

The WebSocket is closed before the connection is established error message indicates that some client code, or other mechanism, has closed the websocket connection before the connection was fully established.


1 Answers

I guess I should have checked this earlier in the chromium bug section but I was not sure if it is a bug. It has been reported earlier by someone and a chromium bug already exists :

Issue 51687 : WebSocket: Send close with code 1001 on reload / tab close

Update : Someone has submitted a patch to fix this issue, can be seen in the above link.

like image 57
Rndm Avatar answered Oct 10 '22 08:10

Rndm