From 8c5b5f17ebd46b555006a64def1aeb60e441a34e Mon Sep 17 00:00:00 2001 From: Shira Maximov Date: Wed, 17 Jul 2019 10:25:05 +0300 Subject: [PATCH] Add support in websocket sub-protocols --- kasmweb/core/rfb.js | 3 ++- kasmweb/docs/API.md | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kasmweb/core/rfb.js b/kasmweb/core/rfb.js index cb4b4dd..3cf3943 100644 --- a/kasmweb/core/rfb.js +++ b/kasmweb/core/rfb.js @@ -57,6 +57,7 @@ export default class RFB extends EventTargetMixin { this._shared = 'shared' in options ? !!options.shared : true; this._repeaterID = options.repeaterID || ''; this._showDotCursor = options.showDotCursor || false; + this._wsProtocols = options.wsProtocols || ['binary']; // Internal state this._rfb_connection_state = ''; @@ -472,7 +473,7 @@ export default class RFB extends EventTargetMixin { try { // WebSocket.onopen transitions to the RFB init states - this._sock.open(this._url, ['binary']); + this._sock.open(this._url, this._wsProtocols); this.sentEventsCounter+=1; } catch (e) { if (e.name === 'SyntaxError') { diff --git a/kasmweb/docs/API.md b/kasmweb/docs/API.md index d587429..803176c 100644 --- a/kasmweb/docs/API.md +++ b/kasmweb/docs/API.md @@ -187,6 +187,9 @@ connection to a specified VNC server. - A `DOMString` specifying the ID to provide to any VNC repeater encountered. + `wsProtocols` + - Protocols to use in the WebSocket connection, the default is: ['binary'] + #### connect The `connect` event is fired after all the handshaking with the server