From 0d2ecc9d3d93cafc2c1310a290b7c042ad2d1e38 Mon Sep 17 00:00:00 2001 From: Joel Mathew Thomas <90510078+joelmathewthomas@users.noreply.github.com> Date: Thu, 20 Mar 2025 00:53:16 +0530 Subject: [PATCH] proxy websocket url --- client/src/contexts/WebSocketContext.tsx | 2 +- client/vite.config.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/contexts/WebSocketContext.tsx b/client/src/contexts/WebSocketContext.tsx index c345a18..eaca89c 100644 --- a/client/src/contexts/WebSocketContext.tsx +++ b/client/src/contexts/WebSocketContext.tsx @@ -1,6 +1,6 @@ import React, { createContext, useContext, useEffect, useState } from "react"; -const WEBSOCKET_URL = "ws://localhost:8000/ws/freqsplit/"; +const WEBSOCKET_URL = "/ws/freqsplit/"; interface WebSocketContextType { socket: WebSocket | null; diff --git a/client/vite.config.ts b/client/vite.config.ts index 12f020c..700d569 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -10,6 +10,11 @@ export default defineConfig({ target: 'http://localhost:8000', changeOrigin: true, }, + '/ws': { + target: "ws://localhost:8000", + ws: true, + changeOrigin: true, + } }, }, })