C++ SDK — Matchmaking

Matchmaking

getMatchmakingLobbies
template<typename T = nlohmann::json>
static MatchmakingListResponse<T> getMatchmakingLobbies(
    Client& client,
    const std::optional<std::string>& search = std::nullopt,
    const std::optional<int>& limit = std::nullopt
)

Lists all available matchmaking lobbies with typed rules support. Supports search and limit parameters (limit: 1-50).

createMatchmakingLobby
template<typename TPlayerData = nlohmann::json, typename TRules = nlohmann::json>
static MatchmakingCreateResponse createMatchmakingLobby(
    Client& client,
    const std::string& playerToken,
    const std::string& matchmakingName,
    int maxPlayers = 4,
    bool strictFull = false,
    bool joinByRequests = false,
    bool hostSwitch = false,
    bool canLeaveRoom = true,
    bool realtimeRoom = false,
    const std::optional<std::string>& password = std::nullopt,
    const std::optional<TPlayerData>& playerData = std::nullopt,
    const std::optional<TRules>& rules = std::nullopt
)

Creates a new matchmaking lobby with name, optional password, typed rules support, host switching, and player data. Max players: 2-16.

getCurrentMatchmakingStatus
template<typename T = nlohmann::json>
static MatchmakingCurrentResponse<T> getCurrentMatchmakingStatus(
    Client& client,
    const std::string& playerToken
)

Gets the current player's matchmaking status and lobby information with typed rules.

joinMatchmakingDirectly
template<typename T = nlohmann::json>
static MatchmakingDirectJoinResponse joinMatchmakingDirectly(
    Client& client,
    const std::string& playerToken,
    const std::string& matchmakingId,
    const std::optional<T>& playerData = std::nullopt
)

Joins a matchmaking lobby directly (only works if lobby doesn't require approval).

leaveMatchmaking
static MatchmakingLeaveResponse leaveMatchmaking(
    Client& client,
    const std::string& playerToken
)

Leaves the current matchmaking lobby.

getMatchmakingPlayers
template<typename T = nlohmann::json>
static MatchmakingPlayersResponse<T> getMatchmakingPlayers(
    Client& client,
    const std::string& playerToken
)

Gets all players in the current matchmaking lobby.

sendMatchmakingHeartbeat
static MatchmakingHeartbeatResponse sendMatchmakingHeartbeat(
    Client& client,
    const std::string& playerToken
)

Sends heartbeat to maintain connection in matchmaking lobby.

removeMatchmakingLobby
static MatchmakingRemoveResponse removeMatchmakingLobby(
    Client& client,
    const std::string& playerToken
)

Removes the matchmaking lobby (host only).

startGameFromMatchmaking
static MatchmakingStartResponse startGameFromMatchmaking(
    Client& client,
    const std::string& playerToken
)

Starts a game from matchmaking lobby (host only).

stopMatchmaking
static SuccessResponse stopMatchmaking(
    Client& client,
    const std::string& playerToken
)

Stops matchmaking lobby (Host Only). Cannot be called after game has started.

kickPlayer
static MatchmakingKickResponse kickPlayer(
    Client& client,
    const std::string& playerToken,
    int playerId
)

Kicks a player from matchmaking lobby (Host Only). Cannot kick yourself or after matchmaking has started.

updateMatchmakingPassword
static SuccessResponse updateMatchmakingPassword(
    Client& client,
    const std::string& playerToken,
    const std::optional<std::string>& password = std::nullopt
)

Updates the matchmaking password (Host Only). Cannot change password after matchmaking has started. Use nullopt to remove password.

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.
  • Calls are synchronous functions that take the client by reference — keep them off the frame-critical path in games that cannot stall, and use the typed template overloads to deserialize player data into your own structs.