From c90df623decf6effc4554245fb436adf98c9ab52 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Thu, 3 Oct 2024 14:06:03 +0530 Subject: [PATCH] fix: live base server url. (#5734) * fix: live base server url. * chore: update websocket URL logic. --- web/core/components/pages/editor/editor-body.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/core/components/pages/editor/editor-body.tsx b/web/core/components/pages/editor/editor-body.tsx index c4efaac7b..faa967b7e 100644 --- a/web/core/components/pages/editor/editor-body.tsx +++ b/web/core/components/pages/editor/editor-body.tsx @@ -115,11 +115,11 @@ export const PageEditorBody: React.FC = observer((props) => { const realtimeConfig: TRealtimeConfig | undefined = useMemo(() => { // Construct the WebSocket Collaboration URL try { - const LIVE_SERVER_BASE_URL = LIVE_BASE_URL ?? window.location.origin; - const WS_LIVE_URL = new URL(`${LIVE_SERVER_BASE_URL}${LIVE_BASE_PATH}`); + const LIVE_SERVER_BASE_URL = LIVE_BASE_URL?.trim() || window.location.origin; + const WS_LIVE_URL = new URL(LIVE_SERVER_BASE_URL); const isSecureEnvironment = window.location.protocol === "https:"; WS_LIVE_URL.protocol = isSecureEnvironment ? "wss" : "ws"; - WS_LIVE_URL.pathname = "collaboration"; + WS_LIVE_URL.pathname = `${LIVE_BASE_PATH}/collaboration`; // Construct realtime config return { url: WS_LIVE_URL.toString(),