Skip to content

Reintroduce WebSockets for real-time run, judgement and viewer updates.#533

Open
Jackzzey wants to merge 16 commits into
dres-dev:devfrom
Jackzzey:pr/reintroduce-websockets-2
Open

Reintroduce WebSockets for real-time run, judgement and viewer updates.#533
Jackzzey wants to merge 16 commits into
dres-dev:devfrom
Jackzzey:pr/reintroduce-websockets-2

Conversation

@Jackzzey

Copy link
Copy Markdown

Backend

  • Re-enables ws("ws/run", RunExecutor::accept); RunExecutor
    broadcasts a ServerMessage for each relevant EventStream event
    (task/run start/end, score updates, submissions, new
    ViewerUpdateEvent).
  • ServerMessage now carries optional state / overview /
    teamOverview diffs, so most updates are delivered as data, not
    just a "something changed" signal:
    • TASK_START / TASK_END embed the full evaluation state +
      overview.
    • COMPETITION_UPDATE embeds the overview.
    • TASK_UPDATED (submissions) embeds only the submitting
      team's overview, so one team's submission doesn't require
      re-sending or re-fetching everyone's data.
  • AccessManager.canViewEvaluation enforces the same access
    rules on REGISTER as the REST API.
  • Fixes a self-deadlock in the old (dead) cleanup-thread code;
    connection state moved to ConcurrentHashMap.

Frontend

  • New WebSocketService with reconnect backoff, ping
    keep-alive, and a reconnected$ signal that forces a one-off
    resync after a drop (to cover messages missed while
    disconnected).
  • run-admin-view, run-async-admin-view, run-viewer, and the
    judgement viewers apply the embedded
    state/overview/teamOverview diffs directly when present — no
    REST call needed. They only fall back to an HTTP fetch for the
    few message types that carry no diff (lifecycle events like
    TASK_PREPARE/COMPETITION_END/VIEWER_UPDATE), or as a 30s
    safety-net poll.
  • New specs covering the diff-application and fallback paths
    for all of the above.

All frontend tests pass (103/103). Manually verified diffs are
applied live (no fetch) on task start/end, score updates, and
submissions, and that reconnect triggers a full resync.

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.

1 participant