fix(websocket): 🐛 完善WebSocket端点配置检查逻辑
在所有WebSocket相关组件中添加对VITE_APP_WS_ENDPOINT的检查 确保未配置WebSocket端点时不会尝试建立连接 防止出现"brokerURL or webSocketFactory must be provided"错误
This commit is contained in:
@@ -91,6 +91,13 @@ export function useOnlineCount() {
|
||||
const initWebSocket = () => {
|
||||
if (isConnecting.value) return;
|
||||
|
||||
// 检查WebSocket端点是否配置
|
||||
const wsEndpoint = import.meta.env.VITE_APP_WS_ENDPOINT;
|
||||
if (!wsEndpoint) {
|
||||
console.log("未配置WebSocket端点(VITE_APP_WS_ENDPOINT),跳过WebSocket连接");
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查是否有可用的令牌
|
||||
const hasToken = !!getAccessToken();
|
||||
if (!hasToken) {
|
||||
|
||||
Reference in New Issue
Block a user