feat(rfb): add encoding, FPS and bandwidth event emissions#2041
feat(rfb): add encoding, FPS and bandwidth event emissions#2041alarraz wants to merge 1 commit intonovnc:masterfrom
Conversation
alarraz
commented
Jan 25, 2026
- Add encodingchange event when encoding type changes
- Add FPS counter event emitted every second
- Add bandwidth tracking in websock.js (bytes sent/received)
- Add bandwidth event with download/upload kbps every 2 seconds
- Add encodingchange event when encoding type changes - Add FPS counter event emitted every second - Add bandwidth tracking in websock.js (bytes sent/received) - Add bandwidth event with download/upload kbps every 2 seconds
CendioOssman
left a comment
There was a problem hiding this comment.
Thanks for your contribution!
As this is just a RFB API change, could you describe a bit more what the scenario is where you want to use this?
| // Emit encoding change event for real encodings (not pseudo-encodings) | ||
| if (this._lastEncoding !== this._FBU.encoding && this._FBU.encoding >= 0) { | ||
| this._lastEncoding = this._FBU.encoding; | ||
| this.dispatchEvent(new CustomEvent("encodingchange", | ||
| { detail: { encoding: this._FBU.encoding } })); | ||
| } |
There was a problem hiding this comment.
Encodings can change multiple times per update, so this is not a productive approach.
What information is it you want to present here?
| if (now - this._lastFpsTime >= 1000) { | ||
| this.dispatchEvent(new CustomEvent("fps", | ||
| { detail: { fps: this._frameCount } })); | ||
| this._frameCount = 0; | ||
| this._lastFpsTime = now; | ||
| } |
There was a problem hiding this comment.
Statistics is messy and people will likely want to measure things in different ways with different degrees of accuracy.
Can't we just expose the raw data and let the caller deal with how to aggregate that?
I.e. expose a frame counter and the number of transferred bytes.
| } | ||
|
|
||
| // Bandwidth statistics | ||
| getBandwidthStats() { |
There was a problem hiding this comment.
Please also update the documentation with all API changes.