Skip to content

[BUG]: WebSocket URLs hardcoded to ws://localhost:1313 — breaks any non-local deployment #394

Description

@shwetd19

Bug Description

Several frontend WebSocket call sites hardcode the backend address instead of deriving it from VITE_BASE_URL:

  • frontend/src/components/Matchmaking.tsx line 62
  • (same pattern in other raw new WebSocket(...) call sites: ChatRoom.tsx, TeamDebateRoom.tsx, Game.tsx, gamificationService.ts)

frontend/src/components/DebatePopup.tsx line 31 also hardcodes http://localhost:1313 for room creation.

Impact

Matchmaking, chat, and room creation silently fail on any deployed environment (or even when the backend runs on a different port). The UI shows a permanent "connecting"/"Searching…" state with no error.

Suggested Fix

Build WS URLs from import.meta.env.VITE_BASE_URL (swapping httpws), in one shared helper.

Steps to Reproduce

No response

Logs and Screenshots

No response

Environment Details

No response

Impact

Critical - Application is unusable

Code of Conduct

  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions