Add external event handler for WebSocket connection events
This commit is contained in:
parent
38856472d7
commit
bf18b69cf4
|
|
@ -165,7 +165,8 @@
|
||||||
'onFBUComplete': function () { }, // onFBUComplete(rfb, fbu): RFB FBU received and processed
|
'onFBUComplete': function () { }, // onFBUComplete(rfb, fbu): RFB FBU received and processed
|
||||||
'onFBResize': function () { }, // onFBResize(rfb, width, height): frame buffer resized
|
'onFBResize': function () { }, // onFBResize(rfb, width, height): frame buffer resized
|
||||||
'onDesktopName': function () { }, // onDesktopName(rfb, name): desktop name received
|
'onDesktopName': function () { }, // onDesktopName(rfb, name): desktop name received
|
||||||
'onXvpInit': function () { } // onXvpInit(version): XVP extensions active for this connection
|
'onXvpInit': function () { } // onXvpInit(version): XVP extensions active for this connection,
|
||||||
|
'onWsConnEvent': function () { }, // onWsConnEvent(eventType, event): a WebSocket connection event occurred
|
||||||
});
|
});
|
||||||
|
|
||||||
// main setup
|
// main setup
|
||||||
|
|
@ -208,6 +209,7 @@
|
||||||
} else {
|
} else {
|
||||||
this._fail("Got unexpected WebSocket connection");
|
this._fail("Got unexpected WebSocket connection");
|
||||||
}
|
}
|
||||||
|
this._onWsConnEvent('open');
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
this._sock.on('close', function (e) {
|
this._sock.on('close', function (e) {
|
||||||
Util.Warn("WebSocket on-close event");
|
Util.Warn("WebSocket on-close event");
|
||||||
|
|
@ -229,9 +231,11 @@
|
||||||
this._fail("Server disconnected" + msg);
|
this._fail("Server disconnected" + msg);
|
||||||
}
|
}
|
||||||
this._sock.off('close');
|
this._sock.off('close');
|
||||||
|
this._onWsConnEvent('close', e);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
this._sock.on('error', function (e) {
|
this._sock.on('error', function (e) {
|
||||||
Util.Warn("WebSocket on-error event");
|
Util.Warn("WebSocket on-error event");
|
||||||
|
this.onWsConnEvent('error', e);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._init_vars();
|
this._init_vars();
|
||||||
|
|
@ -1333,7 +1337,8 @@
|
||||||
['onFBUComplete', 'rw', 'func'], // onFBUComplete(rfb, fbu): RFB FBU received and processed
|
['onFBUComplete', 'rw', 'func'], // onFBUComplete(rfb, fbu): RFB FBU received and processed
|
||||||
['onFBResize', 'rw', 'func'], // onFBResize(rfb, width, height): frame buffer resized
|
['onFBResize', 'rw', 'func'], // onFBResize(rfb, width, height): frame buffer resized
|
||||||
['onDesktopName', 'rw', 'func'], // onDesktopName(rfb, name): desktop name received
|
['onDesktopName', 'rw', 'func'], // onDesktopName(rfb, name): desktop name received
|
||||||
['onXvpInit', 'rw', 'func'] // onXvpInit(version): XVP extensions active for this connection
|
['onXvpInit', 'rw', 'func'], // onXvpInit(version): XVP extensions active for this connection
|
||||||
|
['onWsConnEvent', 'rw', 'func'], // onWsConnEvent(eventType, event): A WebSocket connection event occurred
|
||||||
]);
|
]);
|
||||||
|
|
||||||
RFB.prototype.set_local_cursor = function (cursor) {
|
RFB.prototype.set_local_cursor = function (cursor) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue