joule-moq-relay: each end of a WebSocket session pings the other every 30 s #513
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/relay-ws-ping"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The edge relay's link to its home relay runs over
wss://through a tunnel that closes connections it sees idle. With no one watching, the link carried nothing, so the tunnel cut it every two minutes. Each time the edge redialled within two seconds: the edge's journal showed an end-and-reopen pair every ~126 s, and the home relay logged a new hop link at each one.The change: each end of a WebSocket session (relay accepting, or relay dialling an upstream) sends a WebSocket ping (RFC 6455 §5.5.2) every 30 s while the session lasts. The peer's WebSocket answers with a pong, so a front between them sees traffic both ways. The MOQT session is unaffected: the receiver already ignored non-binary messages, and the library answers pings.
transport/websocket.rs:PING_EVERY(30 s);sessionpings at it, andsession_pingingtakes the interval. The sender is shared with the ping task, which holds only a weak reference, so the pings stop when the session's sender is dropped or a ping cannot be sent.README.md: the binding gains step 8, "Keeping alive".Checks (Framework box):
cargo test --locked -p joule-moq-relay: every test passes, including the newan_idle_session_pings_its_peer(three pings at a 50 ms interval).break, the new test fails ("0 arrived"); restored.cargo clippy -p joule-moq-relay --all-targets --no-deps -D warnings: nothing in the changed files. The host's newer clippy flagsserver.rs:182(a largeErrvariant), which this change does not touch; CI's pinned clippy passes it on main.Deploy note: the edge (ash-1) needs the rebuilt relay for the pings on its upstream link; the home relay gains them for the sessions it accepts.
🤖 Generated with Claude Code