From 303901ce214caeb69b0b28fd10e6494bc5437f70 Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Tue, 1 Oct 2024 21:11:37 +0530 Subject: [PATCH 1/2] fix: live base server url. --- web/core/components/pages/editor/editor-body.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/core/components/pages/editor/editor-body.tsx b/web/core/components/pages/editor/editor-body.tsx index c4efaac7bfe..4a1a8881d2c 100644 --- a/web/core/components/pages/editor/editor-body.tsx +++ b/web/core/components/pages/editor/editor-body.tsx @@ -115,7 +115,7 @@ 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 LIVE_SERVER_BASE_URL = LIVE_BASE_URL?.trim() || window.location.origin; const WS_LIVE_URL = new URL(`${LIVE_SERVER_BASE_URL}${LIVE_BASE_PATH}`); const isSecureEnvironment = window.location.protocol === "https:"; WS_LIVE_URL.protocol = isSecureEnvironment ? "wss" : "ws"; From 1b306e60257105135baa4e4bceba425eff26fded Mon Sep 17 00:00:00 2001 From: Prateek Shourya Date: Thu, 3 Oct 2024 02:24:40 +0530 Subject: [PATCH 2/2] chore: update websocket URL logic. --- web/core/components/pages/editor/editor-body.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/core/components/pages/editor/editor-body.tsx b/web/core/components/pages/editor/editor-body.tsx index 4a1a8881d2c..faa967b7efa 100644 --- a/web/core/components/pages/editor/editor-body.tsx +++ b/web/core/components/pages/editor/editor-body.tsx @@ -116,10 +116,10 @@ export const PageEditorBody: React.FC = observer((props) => { // Construct the WebSocket Collaboration URL try { const LIVE_SERVER_BASE_URL = LIVE_BASE_URL?.trim() || window.location.origin; - const WS_LIVE_URL = new URL(`${LIVE_SERVER_BASE_URL}${LIVE_BASE_PATH}`); + 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(),