From bc0a2ca43c8a8936a27b530aa8ec4933c7ef60e6 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 10 Oct 2025 12:22:26 -0500 Subject: [PATCH] fixed base URL for websockets connection --- frontend/src/hooks/useJobStatusWebSocket.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/hooks/useJobStatusWebSocket.ts b/frontend/src/hooks/useJobStatusWebSocket.ts index 24a2c8a..0eda504 100644 --- a/frontend/src/hooks/useJobStatusWebSocket.ts +++ b/frontend/src/hooks/useJobStatusWebSocket.ts @@ -140,10 +140,12 @@ export function useJobStatusWebSocket( const protocol = apiUrl.protocol === 'https:' ? 'wss:' : 'ws:'; const host = apiUrl.host; // Use backend host, not window.location.host - const basePath = `/api/v1/ws/jobs`; - const path = jobId ? `${basePath}/${jobId}` : basePath; + // Include pathname from API base URL (e.g., /video-accessibility-back) + const apiPathname = apiUrl.pathname.replace(/\/$/, ''); // Remove trailing slash + const wsPath = `/api/v1/ws/jobs`; + const fullPath = jobId ? `${apiPathname}${wsPath}/${jobId}` : `${apiPathname}${wsPath}`; const token = encodeURIComponent(accessToken || ''); - return `${protocol}//${host}${path}?token=${token}`; + return `${protocol}//${host}${fullPath}?token=${token}`; }, [jobId, accessToken]); const handleStatusUpdate = useCallback((update: JobStatusUpdate) => {