fix(web): 强制 Socket.IO 使用 WebSocket 传输

因为线上环境没有配置 IP Hash (Sticky Sessions),导致默认的 polling 长轮询请求会随机分配到不同后端,从而引发 400 Bad Request 和连接断开重连刷屏的问题。
现将 transports 锁定为 ['websocket'],直接使用 WebSocket 连接。
This commit is contained in:
2026-08-08 10:42:00 +08:00
parent 3d38e16917
commit 41546cce96
4 changed files with 6 additions and 7 deletions
+2 -2
View File
@@ -23,8 +23,8 @@ createApp({
});
const connected = ref(false);
// Keep the legacy route console usable behind proxies that only allow polling.
const socket = io({ transports: ['polling', 'websocket'], timeout: 20000 });
// 强制使用 WebSocket,避免轮询 (polling) 在负载均衡/反代下产生 400 Bad Request
const socket = io({ transports: ['websocket'], timeout: 20000 });
const stations = ref([]);