Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

/live sends everyone a coalesced presence frame {type:'presence', here, signedIn, watching} within 1 s of a connect or disconnect - lobby and test only #368

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

/live now sends a coalesced presence frame, {type:'presence', here, signedIn, watching}. Only lobby.ts and lobby.test.ts changed. The 44 lobby tests pass.

Notes

shipped merged

opened this

/live now sends a coalesced presence frame, {type:'presence', here, signedIn, watching}. Only lobby.ts and lobby.test.ts changed. The 44 lobby tests pass. I couldn't run bun x tsc --noEmit: bun reported unable to write files to tempdir: ReadOnlyFileSystem. The type check is therefore unverified here, and the forge's check will be the first to run it.

  • Counts: here is every open /live socket. signedIn counts each person once by their id, so two tabs of one person count once. watching is the sockets with no identity.
  • Privacy: the frame carries counts only, no names and no addresses.
  • Timing: a connect or disconnect starts a 1 s timer, and the frame goes to everyone when it fires. Further changes inside that second add nothing, so a burst of connects is one frame. A new socket also gets the current counts at once. A new presenceMs option sets the window, and the tests use 60 ms. The timer is cleared in close().
  • Tests: the new lobby presence block covers the counts rising on connect and falling on disconnect, two tabs of one person counting once with no name in the frame, and a burst of five connects giving the existing watcher one frame.

🤖 Generated with Claude Code

Closes #358

commented

/live now sends a coalesced presence frame, {type:'presence', here, signedIn, watching}. Only lobby.ts and lobby.test.ts changed. The 44 lobby tests pass. I couldn't run bun x tsc --noEmit: bun reported unable to write files to tempdir: ReadOnlyFileSystem. The type check is therefore unverified here, and the forge's check will be the first to run it.

  • Counts: here is every open /live socket. signedIn counts each person once by their id, so two tabs of one person count once. watching is the sockets with no identity.
  • Privacy: the frame carries counts only, no names and no addresses.
  • Timing: a connect or disconnect starts a 1 s timer, and the frame goes to everyone when it fires. Further changes inside that second add nothing, so a burst of connects is one frame. A new socket also gets the current counts at once. A new presenceMs option sets the window, and the tests use 60 ms. The timer is cleared in close().
  • Tests: the new lobby presence block covers the counts rising on connect and falling on disconnect, two tabs of one person counting once with no name in the frame, and a burst of five connects giving the existing watcher one frame.

🤖 Generated with Claude Code

Approved

Does what the issue asks, lobby and test only. The frame is counts only (no names or addresses). Two tabs of one person count once, and here and watching are right. The timer is unref-ed and cleared in close(). I could not run the new tests on this head here, and the type check is still unverified, so the forge check is the first to run it. Two things I would do next: (1) the burst test starts its 60 ms window at the watcher own connect, so on a slow machine the frame can land mid-burst and give [1,3,6]. Make it wait for a presence frame with here:6 and assert there were fewer than six frames, or widen presenceMs for that test. (2) The page and the terminal do not show the counts yet. That is fine for this pull, but it needs its own small pull so both doors get it, with a README line.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs