feat: add tx/rx counters

This commit is contained in:
2023-07-15 16:52:03 +02:00
parent a06a960947
commit a7584c9ebe
+12
View File
@@ -20,6 +20,8 @@ export class Client extends EventEmitter {
#address
#keepAliveInterval
#lastPacketDate = 0
#tx = 0
#rx = 0
constructor(gateway) {
super()
@@ -37,6 +39,7 @@ export class Client extends EventEmitter {
console.log('sending:', buf)
this.#ws.send(buf)
this.#tx++
this.#lastPacketDate = Date.now()
}
@@ -88,6 +91,7 @@ export class Client extends EventEmitter {
oneofs: true
})
this.#rx++
this.emit('raw', container)
}
@@ -191,4 +195,12 @@ export class Client extends EventEmitter {
get lastPacketDate() {
return this.#lastPacketDate
}
get tx() {
return this.#tx
}
get rx() {
return this.#rx
}
}