5 minutes
Make a Room, Share a Link
Last lesson we built a room server that hands out seats and creates one shared secret seed. It works, but no one can reach it yet: you can't type a code, send a link to a friend, or turn "a server is running" into "I'm in seat 2." That missing piece is client code, and it runs before the scene loads — you can't open a peer mesh until you know your own seat at the table.
All of that pre-scene work lives in one module, roomClient.ts — plain functions, no System and no EventBus yet. They figure out which seat a browser gets, then split that answer into the inputs the networked scene needs.
Generate a room code
A room needs a short name, easy to read aloud over the phone. generateRoomCode makes one: six letters, nothing more.
From the room client:
The randomness is an argument defaulting to Math.random, so a test can pass its own and get the same code every run. Call it with no arguments and you get a string — drop that straight into the address bar:
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.