Skip to content

v1.4.0 — protocol 3: a slow phone holds back only its own stream

Choose a tag to compare

@yetone yetone released this 08 Nov 22:24
· 4 commits to main since this release

Protocol 3 gives each stream its own credit. The relay advertises window (1 MiB, FLOW_STREAM_WINDOW_KB) in registered, and acknowledges response body / WebSocket bytes with {t:'ack', id, n} once they are on their way to the phone. The desktop keeps at most one window of each stream unacknowledged.

Before this, a phone that stopped reading made the Node edition stop reading the whole agent socket, so every other phone, herdr viewer and E2E tunnel on that desktop stalled with it. The Cloudflare edition held whatever the desktop sent in Durable Object memory.

  • Node: acknowledges from the res.write / ws send callbacks. A stream that writes none of what it owes for STALL_TIMEOUT_S is cut off. Pausing the whole socket stays as a safety net for desktops that ignore their window.
  • Cloudflare: acknowledges response bytes as the phone pulls them, and WebSocket messages as they are sent.
  • RELAY_PROTOCOL=2 turns protocol 3 off. Older desktops are unaffected.
  • Desktop support: Alma with PR yetone/alma#492 (protocol 3 client).

See docs/PROTOCOL.md.