feat: ws连接

This commit is contained in:
2026-06-01 09:35:11 +08:00
parent 6ac5eb9664
commit 6c4ebc26d1

View File

@@ -37,10 +37,12 @@ class WebSocketManager {
}
// 根据当前页面协议自动选择 ws 或 wss
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
// const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
const protocol = 'wss:'
// 从环境变量获取 WebSocket 主机地址
const wsHost = import.meta.env.VITE_WS_HOST || '18.167.251.121:10094'
// const wsHost = import.meta.env.VITE_WS_HOST || '18.167.251.121:10094'
const wsHost = 'www.develop-ms.api.aida.com.hk'
this.url = `${protocol}//${wsHost}/ws?token=${token}`
this.isManualClose = false