feat: add tx/rx counters
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user