Skip to content

Commit

Permalink
修改: socket.ts 尝试修复个别浏览器socket异常问题
Browse files Browse the repository at this point in the history
  • Loading branch information
feiyuchuixue committed Jan 9, 2025
1 parent 5fe4cac commit 48d48a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/stores/modules/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { useAuthStore } from '@/stores/modules/auth';

// 是否使用socket 当 import.meta.env.VITE_SOCKET_URL 不为空时,启用websocket
const useSocket = Object.prototype.hasOwnProperty.call(import.meta.env, 'VITE_SOCKET_URL');
//const socketUrl = import.meta.env.VITE_SOCKET_URL;
const socketUrl = new URL(import.meta.env.VITE_SOCKET_URL, window.location.origin).toString();
const socketUrl = new URL(import.meta.env.VITE_SOCKET_URL, window.location.origin);
socketUrl.protocol = socketUrl.protocol === 'https:' ? 'wss:' : 'ws:';
const MAX_RECONNECT_COUNT = 10;

/**
Expand Down

0 comments on commit 48d48a4

Please sign in to comment.