Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.
This repository was archived by the owner on May 14, 2026. It is now read-only.

Dashboard misses real-time session updates: WS event-type mismatch #23

Description

@mondominator

Symptom

New streams take up to 30 seconds to appear on the dashboard even when OpsDec's backend has already processed the session update. WebSocket is connected, but real-time updates are silently dropped and only the 30s polling loop actually refreshes the UI.

Root cause

Event-type mismatch between the backend broadcast and the frontend listener:

  • `backend/src/services/monitor.js:1301` broadcasts:
    ```js
    broadcast({ type: 'activity', data: currentSessions });
    ```
  • `frontend/src/pages/Dashboard.jsx:117` listens for:
    ```js
    if (data.type === 'session.update') { ... }
    ```

Those strings don't match, so the message is received over the socket and then ignored. The dashboard still updates because `loadData()` runs on a `setInterval(..., 30000)` — but that's not real-time, and it masks the fact that WS-driven updates don't work at all.

Repro

  1. Start a new stream on any server OpsDec is monitoring
  2. Watch the OpsDec backend logs — `📺 New session started: ...` appears
  3. Dashboard does NOT update
  4. Wait up to 30s — dashboard finally refreshes on the next poll

Fix options

Pick one:

  • Change the backend to broadcast `type: 'session.update'` so it matches the listener
  • Or change the frontend to listen for `type: 'activity'` to match the backend
  • Ideally settle on one convention across all broadcasts (look for other `broadcast({...})` callsites too)

Why this matters

Without real-time updates, the Dashboard loses most of its value — especially for audiobook sessions where the state changes (play/pause/seek) happen often and the 30s lag is very visible. This is probably why the dashboard has felt "sluggish" on new-stream detection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions