LobbyLab rooms: the room lifecycle

LobbyLab is a hosted multiplayer backend. Your game keeps its own UI, engine and domain; players join LobbyLab rooms over WebSockets through @lobbylab/client, and LobbyLab keeps the rooms, invite codes, matchmaking and shared game state. Game rules that run on LobbyLab's servers come later. Request an alpha key at https://lobbylab.gg/developers.

Status: the room engine below runs every room on lobbylab.gg today. The parts marked (API) arrive with the Multiplayer API alpha and may change before then.

Two kinds of rooms, one engine

Both use the same sockets, members, reconnection and the multiplayer-wire/v0 protocol.

Rooms of games built on LobbyLab

lobby ──the host starts──> active ──the host ends it, the game ends it, the time limit, or faults──> ended
PhaseWhat happens
lobbyPlayers join and take seats. The host picks the settings, for example how many AI players fill empty seats
activeThe game runs: turn-based games change on each accepted action, live games also advance on a fixed tick
endedFinal. Nothing more happens, and the sockets close. Start a new room to play again

A finished match does not end the room: games show the results and offer a rematch, so everyone stays together. A live game's room ends after its time limit (at most 120 minutes) or when its rules fail three ticks in a row.

Rooms for your own game (API)

A room is open from creation until it is closed, with one of these reasons:

ReasonWhen
host_closedThe host closed the room
emptyEveryone left and nobody came back within the room type's emptyTtlSec (live 10 to 600 s, default 60; turn-based 60 s to 24 h, default 15 min)
time_limitThe room reached maxLifetimeMin (live up to 120 minutes, the default; turn-based up to 24 hours, the default)
host_leftThe host left and the room type does not hand the host role on (hostMigration: "none")
server_closedYour backend closed it with the secret key
project_disabledThe project was turned off

The host role passes to the longest-seated player when the host leaves (hostMigration: "oldest", the default), after hostGraceSec (default 10 s). A locked room refuses new joins; seated members can still reconnect.

Members

Joining

  1. Get a seat: its credential and socket address. On lobbylab.gg the invite link (https://lobbylab.gg/join/<room>) does this. With the API: POST /v1/rooms/join with a room code, POST /v1/rooms/{roomId}/join, or quick join with POST /v1/matchmake, which seats you in the fullest open public room of a type or creates one.
  2. Open the WebSocket and send hello (see the protocol doc). The server answers ready with your memberId, the phase and your roles, then the current view.
  3. Games decide whether friends can join after the start (drop in) or only in the lobby.

Room codes are 6 letters from BCDFGHJKLMNPQRSTVWXZ: no vowels, so a code never spells a word (API).

Staying connected

Turn-based and live rooms

Turn-based (tick: 0)Live (tick: 20)
ChangesOne accepted change at a time, each savedEach player's input slot, applied on a 20 Hz tick
What clients getsnapshot after each changeframe messages at the frame rate
Sizes (API)state up to 64 KBa player slot up to 1 KB; the view up to 8 KB per frame
Good forBoard, card, trivia and word gamesRacing, arenas, action games

Limits (API)

Every error code has its own page: https://lobbylab.gg/docs/errors.

How long rooms are kept

LobbyLab keeps a room's record, including the names used in it, for up to 30 days after the room ends, then deletes it. See the Privacy Policy at https://lobbylab.gg/legal/privacy.