Skip to content

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

apps/server/src/rtc-wire ​

What the game thread (rtc-host.ts) and the RTC worker (rtc-worker.ts) say to each other. Each side sends at most one message per event-loop turn (an Outbox): the control messages of the turn (an offer, an answer, a candidate, a channel opened or closed) as they are, and the turn's frames packed one after the other into a single buffer that is moved to the other thread, not copied: [peer u32][length u32][bytes], little-endian. The receiver reads the frames first, then the control messages, so a frame sent before a channel is closed is sent before it closes.

The worker's own messages carry the mark WIRE: under node --watch (npm run dev) a worker also reports the modules it loads to its parent, which is not one of them.

Classes ​

Interfaces ​

Type Aliases ​

Variables ​

Functions ​