Add DM typing indicator to the game chat
The server broadcasts a "typing" event to the whole room right when it starts the DM turn, and broadcasts turn failures to everyone too (previously only the sender saw them, which would've left other players' indicators stuck forever). The frontend shows a pulsing "Dungeon Master schreibt …" line that clears once the real reply or an error arrives. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -118,12 +118,13 @@ async def game_websocket(websocket: WebSocket, game_id: uuid.UUID, ticket: str)
|
||||
game_id,
|
||||
{"type": "message", "message": await _serialize_message(session, player_message)},
|
||||
)
|
||||
await manager.broadcast(game_id, {"type": "typing"})
|
||||
|
||||
try:
|
||||
dm_message = await run_dm_turn(session, game_id, latest_player_message=content)
|
||||
except Exception: # noqa: BLE001
|
||||
logger.exception("DM turn failed for game %s", game_id)
|
||||
await websocket.send_json({"type": "error", "detail": "dm_turn_failed"})
|
||||
await manager.broadcast(game_id, {"type": "error", "detail": "dm_turn_failed"})
|
||||
continue
|
||||
|
||||
await manager.broadcast(
|
||||
|
||||
Reference in New Issue
Block a user