From fe6a36f3dcc772433e11162ccd5bab6496a09b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Jurmanovi=C4=87?= Date: Thu, 18 Sep 2025 22:56:47 +0200 Subject: [PATCH] move websocket base url inside of constructor --- src/lib/websocket/client.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/websocket/client.ts b/src/lib/websocket/client.ts index 8a16466..1f1645a 100644 --- a/src/lib/websocket/client.ts +++ b/src/lib/websocket/client.ts @@ -1,5 +1,3 @@ -const BASE_URL = process.env.NEXT_PUBLIC_WEBSOCKET_URL || 'ws://localhost:3000/ws'; - export interface WebSocketMessage { type: 'step' | 'steam_output' | 'error' | 'complete'; server_id: string; @@ -57,9 +55,11 @@ export class WebSocketClient { private reconnectTimer: NodeJS.Timeout | null = null; private shouldReconnect = true; private associatedServerId: string | null = null; + private baseUrl: string; constructor(token: string) { this.token = token; + this.baseUrl = process.env.NEXT_PUBLIC_WEBSOCKET_URL || 'ws://localhost:3000/ws'; } connect(): Promise { @@ -72,7 +72,7 @@ export class WebSocketClient { this.connectionPromise = new Promise((resolve, reject) => { try { - this.ws = new WebSocket(`${BASE_URL}?token=${this.token}`); + this.ws = new WebSocket(`${this.baseUrl}?token=${this.token}`); this.ws.onopen = () => { console.log('WebSocket connected');