Skip to content

Relay mode

UniversalRelayServer is a WebSocket hub with room multiplexing and rate limiting. In peer mode it routes targeted p2p messages, WebRTC signaling, and room-scoped broadcasts. It does not own a game Engine or CRDT state; each client keeps its own replica.

Rooms isolate broadcasts and use generated codes. A room code is routing information, not proof of identity or authorization. The CLI relay is intentionally unauthenticated by design. Do not treat it as an access-control boundary or as a way to establish durable peer identity.

Run the relay with the repository command, for example:

npm run relay
# or, with an explicit port:
npx tsx cli/index.ts relay --port 3000

For production, put the relay behind TLS/WSS and an authenticated deployment boundary, limit exposure, and use authenticated TURN credentials for WebRTC. The relay's rate limiter limits connection traffic; it is not game-rule validation or cheat prevention.