From 35bebf403ca0729174d49e86feb8fb6e468c69de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 13 Nov 2023 13:02:09 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E9=80=82=E9=85=8D=20websocket?= =?UTF-8?q?=E5=9C=A8https=E4=B8=8B=E7=9A=84=E8=BF=9E=E6=8E=A5=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/index.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/views/index.vue b/src/views/index.vue index 3bb7396..b86c019 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -99,7 +99,8 @@ import { initWebSocket } from '@/utils/websocket'; onMounted(() => { - initWebSocket("ws://" + window.location.host + import.meta.env.VITE_APP_BASE_API + "/resource/websocket"); + let protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://' + initWebSocket(protocol + window.location.host + import.meta.env.VITE_APP_BASE_API + "/resource/websocket"); }); const goTarget = (url:string) => {