JavaScript SDK — Matchmaking

Matchmaking — mp.matchmaking

list
await mp.matchmaking.list({ search?, limit? })

Browses public lobbies — no player token needed.

create
await mp.matchmaking.create(playerToken, name, { maxPlayers?, strictFull?, joinByRequests?, hostSwitch?, canLeaveRoom?, realtimeRoom?, password?, rules?, playerData? })

Creates a matchmaking lobby — options map to the wire fields one-to-one.

join
await mp.matchmaking.join(playerToken, matchmakingId, { password?, joinToken?, playerData? })

Direct-joins a lobby, creating the linked room.

leave / players / heartbeat / current
await mp.matchmaking.leave(playerToken)
await mp.matchmaking.players(playerToken)
await mp.matchmaking.heartbeat(playerToken)
await mp.matchmaking.current(playerToken)

Lobby membership lifecycle.

start / stop / remove / kick / password (host)
await mp.matchmaking.start(playerToken)
await mp.matchmaking.stop(playerToken)
await mp.matchmaking.remove(playerToken)
await mp.matchmaking.kick(playerToken, playerId)
await mp.matchmaking.password(playerToken, password)

Host controls — start locks the lobby and spawns the room.

matchmakingRequests
await mp.matchmakingRequests.send(playerToken, matchmakingId, { playerData? })
await mp.matchmakingRequests.respond(playerToken, requestId, 'accept'|'decline')
await mp.matchmakingRequests.status(playerToken, requestId)

Join-request flow for joinByRequests lobbies — players send, hosts answer, requesters poll status.

Lobbies, joins and host controls

Matchmaking is the discovery layer above rooms. List browses public lobbies — no player token needed, so players can window-shop before signing in. Create opens a lobby with your options mapped one-to-one onto wire fields; join attaches a player and creates the linked room; the host's start locks the lobby and spawns the live room everyone plays in.

Private lobbies use a join-request flow instead of open joins: guests request a seat and the host approves. Heartbeat keeps membership alive for the whole lobby lifetime, while leave and current cover exit and state reads. Host controls — stop, remove, kick, password — mirror the room-level controls.

  • Lobby entries are snapshots — refresh the list on a cadence rather than treating it as a live view.
  • Start locks the lobby and spawns the room: build your "all players ready" flow around that transition.
  • Matchmaking finds the game, the room runs it — gameplay traffic (updates, actions, realtime) uses the room APIs.
  • Every call returns a Promise — await inside async functions. In browsers requests run over fetch with CORS; on Node.js 22.12+ the identical API uses the built-in fetch.