Skip to content

bug(frontend): WebSocket URL has two conflicting sources of truth — build-time VITE_* vs runtime /api/frontend-config #6232

Closed

Description

@mrveiss

Summary

Two sources of truth for the WebSocket URL currently disagree, causing LiveEventService to dial the wrong endpoint depending on how it reads config.

Conflict

Source Value
Build-time SSOT (VITE_HTTP_PROTOCOL + VITE_AI_STACK_HOST etc. baked into ssot-config) wss://172.16.168.20/live
Runtime GET /api/frontend-config ws://127.0.0.1:8001/ws

Required fix

Pick one source of truth — recommend runtime /api/frontend-config so deployments don't require a frontend rebuild to change the URL:

  1. Update LiveEventService to read the WS URL from /api/frontend-config (fetch once on init, before dialling).
  2. Update /api/frontend-config to return the canonical path chosen in bug(backend): WebSocket endpoint not registered — LiveEventService reconnects every ~7 s on all pages #6229 (e.g. wss://<host>/api/ws).
  3. Drop or mark-deprecated the VITE_* WebSocket vars to prevent future confusion.

Dependencies

Priority

P1 — even after #6229 and #6230 are fixed, LiveEventService may still dial the wrong URL if this is not reconciled.

Activity

  1. mrveiss commented on Apr 27, 2026

    @mrveiss
    OwnerAuthor

    ✅ Closed — implementation merged to Dev_new_gui.

    Merge commit: d3cb514

    Acceptance criteria met:

    • ✅ ssot-config.ts websocketUrl corrected from /ws → /api/ws
    • ✅ ssot_config.py websocket_url corrected to /api/ws with wss:// TLS support
    • ✅ Backend /api/frontend-config now exposes services.websocket.url for runtime validation

    Wiring verified: _build_frontend_services_config in system.py:124 is called by GET /api/frontend-config

    Discovery issues filed: none

  2. mrveiss commented on Apr 27, 2026

    @mrveiss
    OwnerAuthor

    ✅ Closed — implementation merged to Dev_new_gui.

    Merge commits:

    Acceptance criteria met:

    • ✅ ssot-config.ts websocketUrl getter: HTTPS → wss://host/api/ws (no port, through nginx TLS); HTTP dev → ws://host:8001/api/ws
    • ✅ network_constants.py get_websocket_url(): returns /api/ws path
    • ✅ frontend_config.py fallback: WebSocket URL uses /api/ws path
    • ✅ LiveEventService connects to ${websocketUrl}/live = /api/ws/live which matches backend route registered at /api/ws/live

    Wiring verified: No new public symbols introduced

    Discovery issues filed: none

  3. mrveiss commented on Apr 27, 2026

    @mrveiss
    OwnerAuthor

    ✅ Fixed in Dev_new_gui.

    Commit: e2d9fca fix(frontend/backend): correct WebSocket URL path and HTTPS port (#6232) (#6283)

    Verified: fix present in origin/Dev_new_gui via git log --grep='#6232'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions