lila/packages/db/src
lila 8aaafea3fc feat: multiplayer slice — end to end working
WebSocket server:
- WS auth via Better Auth session on upgrade request
- Router with discriminated union dispatch and two-layer error handling
- In-memory connections map with broadcastToLobby
- Lobby handlers: join, leave, start
- Game handlers: answer, resolve round, end game, game:ready for state sync
- Shared game state store (LobbyGameStore interface + InMemory impl)
- Timer map separate from store for Valkey-readiness

REST API:
- POST /api/v1/lobbies — create lobby + add host as first player
- POST /api/v1/lobbies/:code/join — atomic join with capacity/status checks
- getLobbyWithPlayers added to model for id-based lookup

Frontend:
- WsClient class with typed on/off, connect/disconnect, isConnected
- WsProvider owns connection lifecycle (connect/disconnect/isConnected state)
- WsConnector component triggers connection at multiplayer layout mount
- Lobby waiting room: live player list, copyable code, host Start button
- Game view: reuses QuestionCard, game:ready on mount, round results
- MultiplayerScoreScreen: sorted scores, winner highlight, tie handling
- Vite proxy: /ws and /api proxied to localhost:3000 for dev cookie fix

Tests:
- lobbyService.test.ts: create, join, retry, idempotency, full lobby
- auth.test.ts: 401 reject, upgrade success, 500 on error
- router.test.ts: dispatch all message types, error handling
- vitest.config.ts: exclude dist folder

Fixes:
- server.ts: server.listen() instead of app.listen() for WS support
- StrictMode removed from main.tsx (incompatible with WS lifecycle)
- getLobbyWithPlayers(id) added for handleLobbyStart lookup
2026-04-18 23:32:21 +02:00
..
data formatting 2026-04-10 20:09:46 +02:00
db feat(db): add lobbies and lobby_players tables + model 2026-04-16 14:45:45 +02:00
models feat: multiplayer slice — end to end working 2026-04-18 23:32:21 +02:00
checking-cefr-coverage.ts chore: rename project from glossa to lila 2026-04-13 10:00:52 +02:00
generating-deck.ts chore: rename project from glossa to lila 2026-04-13 10:00:52 +02:00
index.ts added export for lobby model 2026-04-16 19:52:36 +02:00
seeding-cefr-levels.ts chore: rename project from glossa to lila 2026-04-13 10:00:52 +02:00
seeding-datafiles.ts chore: rename project from glossa to lila 2026-04-13 10:00:52 +02:00