]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Add support in websocket sub-protocols
authorShira Maximov <shiramaximov@gmail.com>
Wed, 17 Jul 2019 07:25:05 +0000 (10:25 +0300)
committerShira Maximov <shiramaximov@gmail.com>
Tue, 23 Jul 2019 10:44:18 +0000 (13:44 +0300)
core/rfb.js
docs/API.md

index 85c9a93ff57a514ae3b31558c75f9133efd99a49..ff5c5ac0af67bda17118f52381764aca53c8acff 100644 (file)
@@ -53,6 +53,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 = '';
@@ -397,7 +398,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);
         } catch (e) {
             if (e.name === 'SyntaxError') {
                 this._fail("Invalid host or port (" + e + ")");
index d587429c176f52bce473629df77ab5084519581d..803176cbe5d5dcfc882749c21df5bc25de738aba 100644 (file)
@@ -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