diff --git a/src/types/env.d.ts b/src/types/env.d.ts index 8389dc58c9abbc4f6bdc5ea127f5521ea8109701..15fa03a685064fe17a89f48501bef6f06065c592 100644 --- a/src/types/env.d.ts +++ b/src/types/env.d.ts @@ -69,7 +69,7 @@ interface ImportMetaEnv { VITE_APP_ENV: string; VITE_APP_RSA_PUBLIC_KEY: string; VITE_APP_CLIENT_ID: string; - VITE_APP_WEBSOCKET: boolean; + VITE_APP_WEBSOCKET: string; } interface ImportMeta { readonly env: ImportMetaEnv; diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts index 5ba02432b6c45b92ade20ad9fc87bda91f6674dc..a4529f9c895eb530d4ff8182876206cd5a4af77d 100644 --- a/src/utils/websocket.ts +++ b/src/utils/websocket.ts @@ -33,7 +33,7 @@ let socketError = 0 as number; // 错误次数 // 初始化socket export const initWebSocket = (url: any) => { - if (!import.meta.env.VITE_APP_WEBSOCKET) { + if (import.meta.env.VITE_APP_WEBSOCKET === 'false') { return; } socketUrl = url;