diff --git a/lib/client.js b/lib/client.js index 56cec5a..91b9fcb 100644 --- a/lib/client.js +++ b/lib/client.js @@ -7,7 +7,7 @@ const { MetaWritable, MetaReadable, chunkDecode } = require('./streams.js'); const CALL_TIMEOUT = 7 * 1000; const PING_INTERVAL = 60 * 1000; const RECONNECT_TIMEOUT = 2 * 1000; -const PING_PACKET = Buffer.from('{}'); +const PING_PACKET = {}; const connections = new Set(); @@ -216,7 +216,7 @@ class WebsocketTransport extends Metacom { this.ping = setInterval(() => { if (this.active) { const interval = Date.now() - this.lastActivity; - if (interval > this.pingInterval) this.write(PING_PACKET); + if (interval > this.pingInterval) this.send(PING_PACKET); } }, this.pingInterval);