fix: fixing ping pong

This commit is contained in:
Chubby Granny Chaser
2025-05-21 19:44:24 +01:00
parent 05e8d53783
commit 61dae4cf84
3 changed files with 19 additions and 6 deletions

View File

@@ -34,6 +34,10 @@ export class WSClient {
});
this.ws.on("message", (message) => {
if (message.toString() === "PONG") {
return;
}
const envelope = Envelope.fromBinary(
new Uint8Array(Buffer.from(message.toString()))
);
@@ -112,7 +116,7 @@ export class WSClient {
private static startHeartbeat() {
this.heartbeatInterval = setInterval(() => {
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
this.ws.ping();
this.ws.send("PING");
}
}, 15_000);
}