yasuki_web.websocket.GameRoom#

class GameRoom(room_id)[source]#

Authoritative game state and connections for one room.

Owns a TableState (the truth) and an ActionLog (the durable tape of intents and chat). Each connection is bound to a seat (P1/P2); every accepted intent is applied through the core, recorded on the tape, and broadcast as a per-viewer redacted SNAPSHOT so a player never receives a card they are not entitled to see.

Methods

GameRoom.__init__(room_id)

GameRoom.add_player(ws, user)

Seat a joining player (P1/P2), replay the room's chat and log history, and announce them.

GameRoom.broadcast_snapshots()

Send each seated player its own redacted SNAPSHOT.

GameRoom.handle_chat(ws, text)

Record a chat line on the durable tape and broadcast it to the whole room.

GameRoom.handle_intent(ws, envelope)

Apply one intent for the acting seat through the authoritative core, record it, and broadcast.

GameRoom.handle_load_deck(ws, yaml_text[, ...])

Parse a deck-builder export YAML for the acting seat, stash its dynasty/fate/pre-game name lists for setup, and announce the load.

GameRoom.handle_ready(ws, ready[, solo])

Set the acting seat's ready flag and deal the opening table once everyone seated is ready.

GameRoom.handle_reset(ws)

Record the acting seat's vote for a new game.

GameRoom.log(parts)

Store and broadcast a game-log line (text and card-link segments) to the whole room.

GameRoom.remove_player(ws)

Drop one connection, freeing its seat and announcing the departure only when it was the player's last tab — another open tab keeps the seat live for an uninterrupted game.