fix: fix remote browser socket connection and related updates
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user