fix(websocket): 🐛 完善WebSocket端点配置检查逻辑

在所有WebSocket相关组件中添加对VITE_APP_WS_ENDPOINT的检查
确保未配置WebSocket端点时不会尝试建立连接
防止出现"brokerURL or webSocketFactory must be provided"错误
This commit is contained in:
Ray.Hao
2025-04-29 23:46:32 +08:00
parent 142d808a5e
commit d619e3c2e6
3 changed files with 26 additions and 0 deletions

View File

@@ -59,6 +59,13 @@ function createDictSyncHook() {
*/
const initWebSocket = async () => {
try {
// 检查是否配置了WebSocket端点
const wsEndpoint = import.meta.env.VITE_APP_WS_ENDPOINT;
if (!wsEndpoint) {
console.log("[WebSocket] 未配置WebSocket端点,跳过连接");
return;
}
// 连接WebSocket
connect();