mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: websocket: allow any message as heartbeat
This commit is contained in:
1 file changed
+1
-1
@@ -388,9 +388,9 @@ export function Connection(
|
||||
if (Date.now() - lastHeartbeat > 40000) conn.close(4000, 'Heartbeat timeout');
|
||||
}, 40000);
|
||||
conn.onmessage = (e) => {
|
||||
lastHeartbeat = Date.now();
|
||||
if (e.data === 'ping') {
|
||||
conn.send('pong');
|
||||
lastHeartbeat = Date.now();
|
||||
return;
|
||||
}
|
||||
h.message?.(JSON.parse(e.data.toString()));
|
||||
|
||||
Reference in new issue
Block a user