feat: add sendKeepAlive
This commit is contained in:
+7
-3
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user