From 464d5a34b0880cd387ab015f932411f0789e1cf5 Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Mon, 27 May 2024 21:48:46 +0800 Subject: [PATCH] =?UTF-8?q?wss=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/AjaxUtils.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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) {