Room.launch & options
Launch a room from Node with @disko-game/room, and every launch option.
A room is a Node program built on the @disko-game/room package. The
package does the heavy lifting: networking, the game engine and the physics
run inside it, in a fast native part that comes prebuilt. Your code just
starts a room and reacts to what happens in it.
It needs Node.js 22 or later and ES modules:
What launching does
Room.launch(options) does everything needed to open a room, in an order
chosen so that nothing half-ready is ever visible to players:
The game loads before the room is listed, so players never find a room that
has no game. If any step fails, launch rejects with a DiskoError and
cleans up everything it had started.
The package never reads environment variables itself. Read your own
configuration and pass it as options. The room template's main.js does this
with ROOM_ID, ROOM_TOKEN, GAME, and the optional LISTEN and
PUBLIC_URL. It targets the production disko services; DISKO_PROFILE=local
targets a local stack, and DISKO_API_URL, DISKO_REGISTRY_URL and
DISKO_PLAY_URL override single services.
The same host function runs in a test room when you
copy it into a game project as server.js.
The options are grouped below. Each table lists the default and the rules a value must follow.
Identity and game
| Option | Default | Rules |
|---|---|---|
id | required | 32 lowercase hex characters, from the Creator Portal or a test room |
token | required | the room's hosting token; never logged or exposed on the Room |
name | required | 1–96 UTF-8 bytes, not blank, no control characters |
game | required | a release reference "ns/slug@version", or { path } for a local directory or .tgz |
players | { name: "display" } | the name policy: "display" or "username" |
Directory and admission
| Option | Default | Rules |
|---|---|---|
description | "" | at most 1024 UTF-8 bytes |
public | true | listed in the directory; test rooms are never listed |
guests | true | admit players without an account |
location | null | { latitude, longitude } |
password | null | 1–4096 UTF-8 bytes; read it from your own secret store |
capacity | 64 | 1–65535 admitted players |
Network
| Option | Default | Rules |
|---|---|---|
listen | "0.0.0.0:4433" | UDP bind address; see ports |
publicUrl | derived | the WebTransport URL players connect to |
transportPath | "/room" | |
certificate | automatic | { certificatePem, privateKeyPem } as PEM strings |
Operations
| Option | Default | Rules |
|---|---|---|
endpoints | production hosts | { api?, registry?, play? } base URLs |
cacheDir | OS cache dir + /disko-game/releases | release cache, keyed by digest |
leaseSeconds | 30 | 5–300 |
logging | { filter: "disko=info", format: "pretty" } | engine logs go to stderr; format is "pretty" or "json" |
limits | server defaults | queue and rate overrides, such as eventQueue (4096) |
Unknown option keys reject with invalid_option, so typos are never ignored.
The Room object
The Room that launch resolves to is your handle on the running room.
Its properties always show the current state: id, url, link (the
play.disko.ooo/?room=<id> link you share), state, game, players, and
the directory settings name, description, public, guests,
location and capacity.
To change settings while the room runs, use setName, setDescription,
setPublic, setGuests and setLocation. Directory changes show up for
players within about 200 ms.
Every method returns a Promise that settles once the change has been applied,
and changes to one room apply in the order you make them. A setter checks its
value like the matching launch option and rejects with invalid_option.
After close(), every method rejects with closed.
The room also has permissions, actions, options and bans; see
Permissions & moderation. Every member is
in the @disko-game/room reference.
Errors
Rejections are DiskoError with a code: invalid_option,
invalid_state, invalid_message, invalid_event, unauthorized,
game_not_found, game_removed, game_invalid, game_build_failed,
game_start_failed, registry_unavailable, listen_failed,
certificate_invalid and closed. game_invalid and game_build_failed
carry problems, each linking to its error page. The code is
stable; the message is not. See
DiskoErrorCode for what each code means.