Skip to content

Add field ops socket - #293

Merged
gpbsumido merged 3 commits into
developfrom
ps/field-ops-socket
Nov 26, 2026
Merged

gpbsumido merged 3 commits into
developfrom
ps/field-ops-socket

Conversation

@gpbsumido

Copy link
Copy Markdown
Owner

A WebSocket for the field ops feed, with replay and reconnection support.

  • `/api/field-ops/socket` sends `{ sequence, snapshot }` every second (`?rate=low` for every 5s). The sequence is the whole second of the clock.
  • Reconnect with `?since=` and the missed seconds are sent first, at most 60. The simulation is a pure function of the clock, so replay recomputes those frames. No buffer, no state.
  • The handshake answers 403 unless the `Origin` is on `ALLOWED_ORIGINS`.
  • On SIGTERM/SIGINT the sockets close with 1001 so clients reconnect (and replay) against the next instance instead of holding the drain open.
  • The SSE stream stays until the console has moved over. Removing it is a follow-up.

Verified

  • `pnpm test`: 903 passed, 29 skipped. `pnpm typecheck` clean.
  • New `socket.test.ts`: current frame on connect, ordered replay, the 60 cap, 403 on a bad origin. Written failing first.
  • Version 6.6.0 with a changelog entry.
  • Not checked: behind the production proxy, since I have not deployed it.

No visible UI change, so no screenshots.

@gpbsumido
gpbsumido merged commit 9184275 into develop Nov 26, 2026
12 checks passed
@gpbsumido
gpbsumido deleted the ps/field-ops-socket branch November 26, 2026 20:02
@gpbsumido gpbsumido mentioned this pull request Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant