learn
apps/

WebSocket server

Authenticated room WebSocket transport for presence, scene changes, selections, and laser trails.

The server speaks two protocols over one socket family: presence frames and collaboration frames, each validated and rate-limited. Commits are applied through the shared collaboration service and acknowledged per mutation; previews and selections are fanned out to the room and never stored. One connection entry represents one tab, never one user.

What it owns

  • Ticket-checked room upgrades with owner, editor, and viewer roles
  • Presence: pointers, viewports, joins, and leaves
  • Collaboration: sync snapshots, commits, previews, selections, and laser
  • In-memory room connections plus Redis-backed room state

Files

File list and purposes from the folder README.

FilePurpose
src/index.tsService entry.
src/server.tsRoom WebSocket transport.
src/roomStore.tsIn-memory room connections (presence + collaboration).

Dependencies

LibraryVersion rangeWhy it is used here
ws^8.21.3WebSocket server and test client for room transport.
Development and tooling (3)
LibraryVersion rangeWhy it is used here
@types/node26.4.1Type declarations for Node.js built-ins.
@types/ws^8.18.1Type declarations for ws.
tsx^4.23.13Runs and watches TypeScript sources for development and tests.

Dependencies as of commit b0026d9.

ws-server folder
BrowserAPIRealtimeCacheDatabaseShareddurableephemeral

Talks to

Sources: apps/ws-server/README.md, apps/ws-server/src/README.md, apps/ws-server/src/server.ts, apps/ws-server/src/roomStore.ts (documented at commit b0026d9)

On this page