core: websocket: allow any message as heartbeat

This commit is contained in:
undefined committed 2023-03-28 22:32:40 +08:00
1 parent ef12f1d023
commit b7c61e133b
1 file changed
+1 -1
+1 -1
View File
@@ -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()));