diff --git a/src/util/AjaxUtils.ts b/src/util/AjaxUtils.ts index bcbbfc7..195ac9a 100644 --- a/src/util/AjaxUtils.ts +++ b/src/util/AjaxUtils.ts @@ -45,13 +45,9 @@ export function websocketUrl() { } const location = window.location; const protocol = location.protocol; - console.log(protocol); - let wsProtocol = 'ws'; - if (protocol == 'https') { - wsProtocol = 'wss'; - } + const wsProtocol = protocol.replace('https:', 'wss:').replace('http:', 'ws:') console.log(wsProtocol); - return `${wsProtocol}://${location.host}${WebSocketBaseUrl}`; + return `${wsProtocol}//${location.host}${WebSocketBaseUrl}`; } export function downloadUrl(fileId: string, isDownload?: boolean) {