Feature/VNC-196 Support share sessions connect/disconnect messages (#145)

* update to support share sesasion connect/disconnect messages

* adding username to console msg and updating naming convention

* simplifying event object

* updates based on PR feedback
This commit is contained in:
rspruel 2025-07-12 05:16:44 -04:00 committed by GitHub
parent 9c78950b67
commit 87186d1bed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 41 additions and 0 deletions

View File

@ -1479,6 +1479,8 @@ const UI = {
UI.rfb.addEventListener("inputlock", UI.inputLockChanged);
UI.rfb.addEventListener("inputlockerror", UI.inputLockError);
UI.rfb.addEventListener("screenregistered", UI.screenRegistered);
UI.rfb.addEventListener("sharedSessionUserJoin", UI.sharedSessionUserJoin);
UI.rfb.addEventListener("sharedSessionUserLeft", UI.sharedSessionUserLeft);
UI.rfb.translateShortcuts = UI.getSetting('translate_shortcuts');
UI.rfb.clipViewport = UI.getSetting('view_clip');
UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
@ -3009,6 +3011,17 @@ const UI = {
},
sharedSessionUserJoin(e) {
Log.Info('shared session user joined: ' + e.detail)
UI.sendMessage('sharedSessionUserJoin', e.detail)
},
sharedSessionUserLeft(e) {
Log.Info('shared session user left: ' + e.detail)
UI.sendMessage('sharedSessionUserLeft', e.detail)
},
//Helper to add options to dropdown.
addOption(selectbox, text, value) {
const optn = document.createElement("OPTION");

View File

@ -3593,6 +3593,28 @@ export default class RFB extends EventTargetMixin {
return true;
}
_handleUserJoin() {
const length = this._sock.rQshift32();
if (this._sock.rQwait("KASM Shared Session Join", length, 32)) { return false; }
const text = this._sock.rQshiftStr(length);
this.dispatchEvent(new CustomEvent(
"sharedSessionUserJoin",
{ detail: text }));
return true;
}
_handleUserLeft() {
const length = this._sock.rQshift32();
if (this._sock.rQwait("KASM Shared Session Left", length, 32)) { return false; }
const text = this._sock.rQshiftStr(length);
this.dispatchEvent(new CustomEvent(
"sharedSessionUserLeft",
{ detail: text }));
return true;
}
_normalMsg() {
let msgType;
if (this._FBU.rects > 0) {
@ -3669,6 +3691,12 @@ export default class RFB extends EventTargetMixin {
case 250: // XVP
return this._handleXvpMsg();
case 253: // KASM user joined a shared sessionAdd commentMore actions
return this._handleUserJoin();
case 254: // KASM user left a shared session
return this._handleUserLeft();
default:
this._fail("Unexpected server message (type " + msgType + ")");
Log.Debug("sock.rQslice(0, 30): " + this._sock.rQslice(0, 30));