Skip to content

Fix overlay showing "Idle" after browser refresh when game is running#40

Merged
FlorentPoinsaut merged 2 commits intomainfrom
copilot/fix-idle-overlay-issue
Mar 25, 2026
Merged

Fix overlay showing "Idle" after browser refresh when game is running#40
FlorentPoinsaut merged 2 commits intomainfrom
copilot/fix-idle-overlay-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 25, 2026

On WebSocket reconnect (e.g. OBS browser source refresh), the overlay had no state to render and defaulted to "Idle" — even with an active game — because the server only pushed state on game events and sent nothing to newly connected clients.

Changes

  • overlay/server.py
    • Added _last_state: dict[str, Any] | None cache to OverlayServer
    • broadcast() now stores state before fanning out to clients
    • _websocket_endpoint() immediately sends _last_state to each new client on connect, if a state has been broadcast before
async def _websocket_endpoint(self, websocket: WebSocket) -> None:
    await websocket.accept()
    self._clients.add(websocket)
    if self._last_state is not None:
        await websocket.send_text(json.dumps(self._last_state))
    ...
  • tests/test_overlay.py
    • Added test: client connecting after a broadcast immediately receives cached state
    • Added test: client connecting before any broadcast receives no spurious message
Original prompt

This section details on the original issue you should resolve

<issue_title>Game appears as "Idle" in overlay after a refresh enven it is currently running</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

…efresh

Co-authored-by: FlorentPoinsaut <1256948+FlorentPoinsaut@users.noreply.github.com>
Agent-Logs-Url: https://github.com/solution-libre/streamantix/sessions/d8e08157-afd4-4c7e-9bf4-3cb291598332
Copilot AI changed the title [WIP] Fix game overlay displaying idle after refresh Fix overlay showing "Idle" after browser refresh when game is running Mar 25, 2026
Copilot AI requested a review from FlorentPoinsaut March 25, 2026 08:39
@FlorentPoinsaut FlorentPoinsaut marked this pull request as ready for review March 25, 2026 08:43
@FlorentPoinsaut FlorentPoinsaut merged commit a4084a7 into main Mar 25, 2026
2 checks passed
@FlorentPoinsaut FlorentPoinsaut deleted the copilot/fix-idle-overlay-issue branch March 25, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Game appears as "Idle" in overlay after a refresh enven it is currently running

2 participants