fix(aibox): 缩短 WebSocket 心跳间隔并补全直连页面心跳

前置代理(Nginx/CDN)的 proxy_read_timeout 约 20s,原 25s 心跳
无法在超时前到达,导致连接被代理切断。aibox.js 心跳从 25s 缩短至
10s;frontend.html 直连页面此前完全无心跳,新增 10s 应用层心跳。
This commit is contained in:
qing committed 2026-08-06 09:16:34 +00:00
1 parent bcb1d5d557
commit 7ff73b7d07
2 files changed
+12 -2

No files matched your search

+2 -2
View File
@@ -44,8 +44,8 @@ let ws = null;
let manualClose = false; /* 手动断开则抑制自动重连 */
let reconnectDelay = RECONNECT_MIN;
let reconnectTimer = null;
let heartbeatTimer = null; /* 心跳定时器,25s 发送 ping 保持 WS 连接 */
const HEARTBEAT_INTERVAL = 25000; /* 心跳间隔(< gateway 30s 空闲超时) */
let heartbeatTimer = null; /* 心跳定时器,10s 发送 ping 保持 WS 连接 */
const HEARTBEAT_INTERVAL = 10000; /* 心跳间隔:需低于前置代理(Nginx/CDN)的 proxy_read_timeout */
function startHeartbeat() {
stopHeartbeat();