Skip to content

five-on-it / apps/server/src/rtc-host

apps/server/src/rtc-host ​

The game thread's side of the RTC worker (rtc-worker.ts): the peers the connections' transports open (rtc-transport.ts), relayed to the worker and back in one batch per event-loop turn each way (rtc-wire.ts), and the channel's numbers for /health and the metrics.

The worker is started on the first offer (a server whose clients never offer never loads werift). When it stops (it crashed, or ran out of memory), every peer it held is closed (worker: their connections fall back to the WebSocket and tell their clients), and the next offers are turned away for a while, then start it again: 1 s after the first stop, twice as long after each next one up to 30 s, the count forgotten once a worker has run for a minute.

Classes ​

Interfaces ​

Variables ​