Merge pull request #1262 from shiramax/sub_protocols
Add support in websocket sub-protocols
This commit is contained in:
commit
21387f9c24
|
@ -53,6 +53,7 @@ export default class RFB extends EventTargetMixin {
|
||||||
this._shared = 'shared' in options ? !!options.shared : true;
|
this._shared = 'shared' in options ? !!options.shared : true;
|
||||||
this._repeaterID = options.repeaterID || '';
|
this._repeaterID = options.repeaterID || '';
|
||||||
this._showDotCursor = options.showDotCursor || false;
|
this._showDotCursor = options.showDotCursor || false;
|
||||||
|
this._wsProtocols = options.wsProtocols || ['binary'];
|
||||||
|
|
||||||
// Internal state
|
// Internal state
|
||||||
this._rfb_connection_state = '';
|
this._rfb_connection_state = '';
|
||||||
|
@ -397,7 +398,7 @@ export default class RFB extends EventTargetMixin {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// WebSocket.onopen transitions to the RFB init states
|
// WebSocket.onopen transitions to the RFB init states
|
||||||
this._sock.open(this._url, ['binary']);
|
this._sock.open(this._url, this._wsProtocols);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.name === 'SyntaxError') {
|
if (e.name === 'SyntaxError') {
|
||||||
this._fail("Invalid host or port (" + e + ")");
|
this._fail("Invalid host or port (" + e + ")");
|
||||||
|
|
|
@ -187,6 +187,9 @@ connection to a specified VNC server.
|
||||||
- A `DOMString` specifying the ID to provide to any VNC repeater
|
- A `DOMString` specifying the ID to provide to any VNC repeater
|
||||||
encountered.
|
encountered.
|
||||||
|
|
||||||
|
`wsProtocols`
|
||||||
|
- Protocols to use in the WebSocket connection, the default is: ['binary']
|
||||||
|
|
||||||
#### connect
|
#### connect
|
||||||
|
|
||||||
The `connect` event is fired after all the handshaking with the server
|
The `connect` event is fired after all the handshaking with the server
|
||||||
|
|
Loading…
Reference in New Issue