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.
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).
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.
static RoomLeaveResponse leaveRoom(
Client& client,
const std::string& playerToken
)
Leaves the current game room.
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.
static HeartbeatResponse sendRoomHeartbeat(
Client& client,
const std::string& playerToken
)
Sends heartbeat to maintain connection in game room.
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.
static SuccessResponse stopRoom(
Client& client,
const std::string& playerToken
)
Stops the current game room (Host Only). Completely removes the room and all associated data.
static RoomKickResponse kickPlayer(
Client& client,
const std::string& playerToken,
int playerId
)
Kicks a player from the game room (Host Only). Cannot kick yourself.
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.