mp.roomsawait mp.rooms.create(playerToken, roomName, { password?, maxPlayers?, hostSwitch?, realtime?, rules?, playerData? })
Creates a room — the creator becomes host. realtime:true enables the WS/UDP channel; rules/playerData carry game JSON.
await mp.rooms.list({ search?, limit? })
Public room browser — no player token needed.
await mp.rooms.join(playerToken, roomId, { password?, joinToken?, playerData? })
Joins a room by id — password for protected rooms, joinToken for invite flows.
await mp.rooms.players(playerToken)
Lists occupants of the player's current room.
await mp.rooms.leave(playerToken)
await mp.rooms.heartbeat(playerToken)
await mp.rooms.current(playerToken)
Leave the room, keep membership alive, read current room state.
await mp.rooms.stop(playerToken)
await mp.rooms.kick(playerToken, playerId)
await mp.rooms.password(playerToken, password)
Host controls: stop the room, remove a player, set/clear the room password.
A room is one live game session. Create makes the caller the host; list browses public rooms without needing a player token; join enters by id — with a password for protected rooms. Players lists the occupants of the caller's current room, and leave, heartbeat and current manage the membership lifecycle.
The host gets the controls: stop the room, kick a member, set or clear the password. Room custom data holds shared state — map, mode, phase — that members read to stay in sync, and matchmaking lobbies spawn a linked room when the host starts.