Skip to content

feat(rfb): add encoding, FPS and bandwidth event emissions#2041

Open
alarraz wants to merge 1 commit intonovnc:masterfrom
alarraz:feat/novnc-debug-info
Open

feat(rfb): add encoding, FPS and bandwidth event emissions#2041
alarraz wants to merge 1 commit intonovnc:masterfrom
alarraz:feat/novnc-debug-info

Conversation

@alarraz
Copy link

@alarraz 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
Copy link
Member

@CendioOssman CendioOssman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment on lines +2673 to +2678
// 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 } }));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Encodings can change multiple times per update, so this is not a productive approach.

What information is it you want to present here?

Comment on lines +2694 to +2699
if (now - this._lastFpsTime >= 1000) {
this.dispatchEvent(new CustomEvent("fps",
{ detail: { fps: this._frameCount } }));
this._frameCount = 0;
this._lastFpsTime = now;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update the documentation with all API changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants