games

Active Game Probe

Is anything running in this room? One cheap answer, for both families.

Entering a room used to ask this twice. ChatroomSession probes /games/state for the shared-router formats and /canasta/state for Canasta, and BOTH read the same CanastaGameSession row -- Canasta writes into that table too, and _context deliberately 404s it out of the shared path so the client falls back to the other endpoint. So at most one of the two could ever answer, and when nothing was running neither did.

It is not free. Measured in a browser on 2026-09-12: two requests per student per room entry, eight transitions in that class, ~560 requests across 25 students -- to discover a game that has been started ONCE in that school's entire history (70 games exist platform-wide; one of them at TESI). And the more expensive half was the one that almost never applies: game_state runs a speculative auto_advance over the spec before it can say "nothing here", and its docstring records what happened the day that path took a row lock on every call.

This asks the question without answering the follow-up: one indexed read, no spec, no projection, no advance. The caller fetches full state only once it knows there is something to fetch.

Deliberately NOT folded into GET /chatrooms/{room_name}, which would look tidier and be worse: that payload is fetched on every join AND polled every five seconds, so a query added there costs far more than the probe it replaces.

get/chatrooms/{room_name}/games/active

Path parameters

room_namestring required

Headers

authorizationstring nullable

Response

Successful Response

{"stackTrail":"paths:/chatrooms/{room_name}/games/active:get:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}

Changes

Changed in 1 of the 25 revisions of this API.1

Of the 25 revisions, 1 has no diff computed.