fix: live base server url. (#5734)
* fix: live base server url. * chore: update websocket URL logic.
This commit is contained in:
parent
62c45f3bb1
commit
c90df623de
1 changed files with 3 additions and 3 deletions
|
|
@ -115,11 +115,11 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
||||||
const realtimeConfig: TRealtimeConfig | undefined = useMemo(() => {
|
const realtimeConfig: TRealtimeConfig | undefined = useMemo(() => {
|
||||||
// Construct the WebSocket Collaboration URL
|
// Construct the WebSocket Collaboration URL
|
||||||
try {
|
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 WS_LIVE_URL = new URL(LIVE_SERVER_BASE_URL);
|
||||||
const isSecureEnvironment = window.location.protocol === "https:";
|
const isSecureEnvironment = window.location.protocol === "https:";
|
||||||
WS_LIVE_URL.protocol = isSecureEnvironment ? "wss" : "ws";
|
WS_LIVE_URL.protocol = isSecureEnvironment ? "wss" : "ws";
|
||||||
WS_LIVE_URL.pathname = "collaboration";
|
WS_LIVE_URL.pathname = `${LIVE_BASE_PATH}/collaboration`;
|
||||||
// Construct realtime config
|
// Construct realtime config
|
||||||
return {
|
return {
|
||||||
url: WS_LIVE_URL.toString(),
|
url: WS_LIVE_URL.toString(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue