lobby:start WS handler — broadcast first question #43

Open
opened 2026-04-19 07:23:39 +00:00 by forgejo-lila · 0 comments
Owner

Context

When the host clicks Start Game, the server initializes game state and sends the first question.

Files to change

  • apps/api/src/ws/handlers/gameHandlers.ts — new file.

Behavior

  1. Validate: sender is host, lobby is 'waiting', minimum 2 players.
  2. Generate question sequence via multiplayerGameService.
  3. Store game state in Valkey.
  4. Update lobby status to 'in_progress' in PostgreSQL.
  5. Broadcast game:question with first question to all players.
  6. Start server-side timer.

Acceptance criteria

  • Only host can start
  • Starting with < 2 players returns error
  • All players receive first question simultaneously
  • Lobby status updated in database
  • Game state stored in Valkey
  • Timer begins after question broadcast

Notes

Question format matches GameQuestion from packages/shared (questionId, prompt, gloss, options). Correct answer NOT sent to clients.

## Context When the host clicks Start Game, the server initializes game state and sends the first question. ## Files to change - `apps/api/src/ws/handlers/gameHandlers.ts` — new file. ## Behavior 1. Validate: sender is host, lobby is 'waiting', minimum 2 players. 2. Generate question sequence via multiplayerGameService. 3. Store game state in Valkey. 4. Update lobby status to 'in_progress' in PostgreSQL. 5. Broadcast `game:question` with first question to all players. 6. Start server-side timer. ## Acceptance criteria - Only host can start - Starting with < 2 players returns error - All players receive first question simultaneously - Lobby status updated in database - Game state stored in Valkey - Timer begins after question broadcast ## Notes Question format matches `GameQuestion` from `packages/shared` (questionId, prompt, gloss, options). Correct answer NOT sent to clients.
forgejo-lila added the
multiplayer
label 2026-04-19 07:23:39 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: forgejo-lila/lila#43
No description provided.