Feat: Expiry broadcast + client event handling and robustness #278

Merged
jona.walpert merged 3 commits from feat/lobby-expiry-broadcast into main 2026-04-12 14:57:43 +02:00
jona.walpert commented 2026-04-12 14:45:16 +02:00 (Migrated from git.scicore.unibas.ch)
  • Summary: Implements automatic expiry of empty lobbies and broadcasts a LOBBY_CLOSED event to clients. The client now listens for unsolicited events (requestId=0), removes closed lobby buttons immediately, and parses GET_LOBBY_STATUS responses for a new STATUS parameter (CREATED|RUNNING). Also includes robustness and style fixes (null/unboxing guards, smaller methods, extracted constants).
  • Notes / Backwards compatibility:
    • Clients that don't understand STATUS will fallback to legacy behaviour (no crash)
    • Events are broadcastet to all sessions; if you prefer notifying only previous members, I can adjust to per-member dispatch.
  • Details:
    • Server: scheduled cleanup job (configurable constants) removes empty lobbies older than 30s and dispatches a +OK event payload with EVENT=LOBBY_CLOSED and LOBBY_ID=<id> to sessions.
    • Server: GetLobbyStatusResponse includes STATUS param.
    • Client: ClientService background reader dispatches unsolicited events; LobbyClient.fetchLobbyStatusString() prefers STATUS= param and falls back to legacy token; LobbyButtonGridManager removes mappings and rerenders immediately on LOBBY_CLOSED.
    • Misc: removed unused methods/fields
* **Summary:** Implements automatic expiry of empty lobbies and broadcasts a `LOBBY_CLOSED` event to clients. The client now listens for unsolicited events (requestId=0), removes closed lobby buttons immediately, and parses `GET_LOBBY_STATUS` responses for a new `STATUS` parameter (CREATED|RUNNING). Also includes robustness and style fixes (null/unboxing guards, smaller methods, extracted constants). * Notes / Backwards compatibility: * Clients that don't understand `STATUS` will fallback to legacy behaviour (no crash) * Events are broadcastet to all sessions; if you prefer notifying only previous members, I can adjust to per-member dispatch. * **Details:** * Server: scheduled cleanup job (configurable constants) removes empty lobbies older than 30s and dispatches a `+OK` event payload with `EVENT=LOBBY_CLOSED` and LOBBY_ID=\<id\> to sessions. * Server: GetLobbyStatusResponse includes `STATUS` param. * Client: ClientService background reader dispatches unsolicited events; LobbyClient.fetchLobbyStatusString() prefers `STATUS=` param and falls back to legacy token; LobbyButtonGridManager removes mappings and rerenders immediately on `LOBBY_CLOSED`. * Misc: removed unused methods/fields
jona.walpert commented 2026-04-12 14:52:34 +02:00 (Migrated from git.scicore.unibas.ch)

added 1 commit

  • 3e1d787b - Feat: Add findEmptyLobbiesOlderThan to find and remove stale empty lobbies

Compare with previous version

added 1 commit <ul><li>3e1d787b - Feat: Add findEmptyLobbiesOlderThan to find and remove stale empty lobbies</li></ul> [Compare with previous version](/cs108-fs26/Gruppe-13/-/merge_requests/122/diffs?diff_id=14559&start_sha=bc36892699f1286c1cdf3da86a698a36230fbfa8)
jona.walpert commented 2026-04-12 14:55:09 +02:00 (Migrated from git.scicore.unibas.ch)

added 7 commits

  • 3e1d787b...120a477a - 6 commits from branch main
  • a66c91c6 - Merge branch 'main' into feat/lobby-expiry-broadcast

Compare with previous version

added 7 commits <ul><li>3e1d787b...120a477a - 6 commits from branch <code>main</code></li><li>a66c91c6 - Merge branch &#39;main&#39; into feat/lobby-expiry-broadcast</li></ul> [Compare with previous version](/cs108-fs26/Gruppe-13/-/merge_requests/122/diffs?diff_id=14560&start_sha=3e1d787b69aac875941a782dfd3d8fcac99c206f)
jona.walpert (Migrated from git.scicore.unibas.ch) scheduled this pull request to auto merge when all checks succeed 2026-04-12 14:56:59 +02:00
jona.walpert commented 2026-04-12 14:57:43 +02:00 (Migrated from git.scicore.unibas.ch)

mentioned in commit 93b6338041

mentioned in commit 93b63380411e2a3d4d2116efa12235eaef0852d0
jona.walpert (Migrated from git.scicore.unibas.ch) merged commit 93b6338041 into main 2026-04-12 14:57:43 +02:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: University-of-Basel-Studentprojects/Programmierprojekt#278