pub const IDLE_TIMEOUT: Duration;Expand description
How long an upgraded connection may go without a single frame from the peer.
A WebSocket is a session the client is entitled to hold open with nothing to say — so this bound is on the peer’s liveness, not on its conversation. At half of it the server sends a Ping; every RFC 6455 endpoint answers a Ping with a Pong by itself (§5.5.2 — browsers, tungstenite, websocat and NetGet’s own client all do, without any application code), and a Pong is a frame, so a live-but-silent client never reaches the bound. What does is a peer that has stopped reading or vanished without a FIN: exactly the socket that would otherwise sit in a slot forever. Every inbound frame counts — text, binary, Ping, Pong, Close.
600 seconds, twice the default window a manual rule gives a human (300s,
src/state/intercepts.rs). tungstenite, like most WebSocket libraries, answers a Ping from
inside a read, so a client that stops reading while its application thinks — a model turn,
a person — answers late. At twice that window a Ping sent at the worst moment is still
answered inside the bound. NetGet’s own client keeps reading through a parked turn
(tests/client/websocket/keepalive_test.rs holds it to a 2-second bound); the margin is for
peers that do not. The keepalive costs one small frame per idle connection every five
minutes, which no deployment notices. Declared as the idle_timeout_secs startup parameter.
A message still being answered is not silence. Handlers run in their own tasks while the
frame loop keeps reading, so each holds the connection’s ConnectionActivity busy for the
whole of its answer — a model round-trip, or a manual rule parked for a human — and the
watchdog neither pings nor closes while anything is in flight. On expiry the server sends
Close 1001 (“going away”, RFC 6455 §7.4.1) and ends the connection.