LiveServer.jl
LiveServer.jl copied to clipboard
Normal HTTP connections kept open
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...
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.