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.