fix: fix remote browser socket connection and related updates

This commit is contained in:
Gitead
2026-04-30 11:52:58 -04:00
parent 441cfcc8e3
commit d8f852741a
959 changed files with 13338 additions and 2208 deletions

View File

@@ -8,8 +8,11 @@ import { io, Socket } from "socket.io-client";
// Connect directly to backend to avoid Vite's WS proxy failing on upgrade,
// which causes an unhandled AggregateError from engine.io's Promise.any() probe.
// Use the env var when set; otherwise derive the backend URL from the current
// page's hostname so remote browsers (non-localhost) reach the server correctly.
const SOCKET_URL =
import.meta.env.VITE_API_BASE_URL_BACKEND || "http://localhost:5000";
import.meta.env.VITE_API_BASE_URL_BACKEND ||
`${window.location.protocol}//${window.location.hostname}:5000`;
export const socket: Socket = io(SOCKET_URL, {
withCredentials: true,