diff --git a/src/Client.js b/src/Client.js index e9911bc..8e738d2 100644 --- a/src/Client.js +++ b/src/Client.js @@ -75,9 +75,7 @@ export class Client extends EventEmitter { // send packets periodically to keep the connection alive this.#keepAliveInterval = setInterval(async () => { if ((Date.now() - this.#lastPacketDate) > 30000) { - await this.#protoRequest(KeepAlive.create({ - data: Date.now() - })) + await this.sendKeepAlive() } }, 15000) @@ -123,6 +121,12 @@ export class Client extends EventEmitter { }) } + async sendKeepAlive() { + return await this.#protoRequest(KeepAlive.create({ + data: Date.now() + })) + } + async #publish(port, flags) { const response = await this.#protoRequest(PublishRequest.create({ port,