this._nextIteration();
},
- _disconnected: function (rfb, clean, frame) {
+ _disconnected: function (clean, frame) {
if (!clean) {
this._state = 'failed';
}
var evt = new Event('rfbdisconnected');
evt.clean = clean;
evt.frame = frame;
+ evt.iteration = this._iteration;
this.onrfbdisconnected(evt);
},
message(`Iteration ${evt.number} took ${evt.duration}ms`);
};
player.onrfbdisconnected = function (evt) {
- if (evt.reason) {
+ if (!evt.clean) {
message(`noVNC sent disconnected during iteration ${evt.iteration} frame ${evt.frame}`);
}
};
RecordingPlayer.prototype = {
run: function (realtime, trafficManagement) {
// initialize a new RFB
- this._rfb = new RFB(document.getElementById('VNC_canvas'), 'wss://test');
+ this._rfb = new RFB(document.getElementById('VNC_screen'), 'wss://test');
this._rfb.viewOnly = true;
this._rfb.addEventListener("disconnect",
this._handleDisconnect.bind(this));
this._rfb._sock.send = function (arr) {};
this._rfb._sock.close = function () {};
this._rfb._sock.flush = function () {};
- this._rfb._checkEvents = function () {};
- this._rfb._connect = function () {
- this._sock.init('binary', 'ws');
+ this._rfb._sock.open = function () {
+ this.init();
+ this._eventHandlers.open();
};
},
}
},
- _handleDisconnect(rfb, clean) {
+ _handleDisconnect(evt) {
this._running = false;
- this._disconnected(rfb, clean, this._frame_index);
+ this._disconnected(evt.detail.clean, this._frame_index);
}
};