LiveServer.jl icon indicating copy to clipboard operation
LiveServer.jl copied to clipboard

Normal HTTP connections kept open

Open asprionj opened this issue 5 years ago • 1 comments

To enable arbitrarily long websocket connections, we set readtimeout = 0 on HTTP.listen. The downside of this is that also standard HTTP requests are kept open. When running with verbose=true, one gets several Closed (x): ... Info's per viewer of index.html some minutes after having stopped the server. It's always the ones not corresponding to a websocket.

This is invisible in non-verbose mode, and does not bind many resources, so it is not severe. But it should be addressed anyway, which needed to be done in HTTP.jl. So we'd have to think about a good way of doing this (having a websocket-specific readtimeout with default 0) and file another pull request...

asprionj avatar Apr 06 '19 21:04 asprionj

It might be that the WS connection closes because LiveServer.jl does not implement the ping-pong messages, which force the TCP connection to remain open despite timeouts: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#pings_and_pongs_the_heartbeat_of_websockets

This is implemented in HTTP.WebSockets, but since LiveServer.jl only uses that library partially, I am not sure whether this got carried over.

fonsp avatar Mar 25 '22 20:03 fonsp