diff --git a/src/views/index.vue b/src/views/index.vue index 3bb7396daa6ab9f8e53545387de27b5d297ff9e2..9cb03884f31579b4446526580b7899bc221d4fc3 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"); + const 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) => {