Python SDK — Rooms

Room Management — client.rooms

create
client.rooms.create(
    player_token: str,
    room_name: str,
    max_players: int = 4,
    password: str | None = None,
    host_switch: bool = False,
    realtime: bool = False,
    player_data: Any = None,
    rules: Any = None,
) -> RoomCreateResponse

Creates a new game room with optional password, rules and host player data.

list
client.rooms.list(search: str | None = None, limit: int | None = None, rules_cls: type | None = None) -> RoomListResponse

Retrieves available game rooms. Pass rules_cls to deserialize each room's rules.

join
client.rooms.join(player_token: str, room_id: str, password: str | None = None, player_data: Any = None) -> RoomJoinResponse

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

leave
client.rooms.leave(player_token: str) -> RoomLeaveResponse

Leaves the current game room.

get_players
client.rooms.get_players(player_token: str, data_cls: type | None = None) -> RoomPlayersResponse

Retrieves all players in the current room with typed player_data.

heartbeat
client.rooms.heartbeat(player_token: str) -> HeartbeatResponse

Sends a heartbeat to maintain connection in the game room.

get_current
client.rooms.get_current(player_token: str, rules_cls: type | None = None) -> CurrentRoomResponse

Gets comprehensive room state including pending actions and updates.

stop
client.rooms.stop(player_token: str) -> RoomStopResponse

Stops the current game room (host only). Completely removes the room and all associated data.

kick
client.rooms.kick(player_token: str, player_id: int) -> RoomKickResponse

Kicks a player from the game room (host only). Cannot kick yourself.

update_password
client.rooms.update_password(player_token: str, password: str | None = None) -> RoomPasswordResponse

Updates the room password (host only). Pass None to remove it.