C++ SDK — Rooms

Room Management

createRoom
template<typename TPlayerData = nlohmann::json, typename TRules = nlohmann::json>
static RoomCreateResponse createRoom(
    Client& client,
    const std::string& playerToken,
    const std::string& roomName,
    int maxPlayers = 4,
    const std::optional<std::string>& password = std::nullopt,
    bool hostSwitch = false,
    bool canLeaveRoom = true,
    const std::optional<TPlayerData>& playerData = std::nullopt,
    const std::optional<TRules>& rules = std::nullopt
)

Creates a new game room for multiplayer sessions with typed rules support, host switching, and player data. Max players: 2-16.

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

Retrieves a list of all available game rooms with typed rules support. Supports search and limit parameters (limit: 1-50).

joinRoom
template<typename T = nlohmann::json>
static RoomJoinResponse joinRoom(
    Client& client,
    const std::string& playerToken,
    const std::string& roomId,
    const std::optional<std::string>& password = std::nullopt,
    const std::optional<T>& playerData = std::nullopt
)

Joins an existing game room with optional password and player data.

leaveRoom
static RoomLeaveResponse leaveRoom(
    Client& client,
    const std::string& playerToken
)

Leaves the current game room.

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

Retrieves a list of all players in the current room.

sendRoomHeartbeat
static HeartbeatResponse sendRoomHeartbeat(
    Client& client,
    const std::string& playerToken
)

Sends heartbeat to maintain connection in game room.

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

Gets comprehensive room state including player lists and pending actions with typed support.

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

Stops the current game room (Host Only). Completely removes the room and all associated data.

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

Kicks a player from the game room (Host Only). Cannot kick yourself.

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

Updates the room password (Host Only). Use nullopt to remove password.