Recovered connection event added to openvidu-browser

pull/89/head
miguelrcDEV 2018-07-10 10:35:14 +02:00
parent de27312d1e
commit 6ef7425785
2 changed files with 25 additions and 0 deletions

View File

@ -658,6 +658,11 @@ export class OpenVidu {
private reconnectedCallback(): void { private reconnectedCallback(): void {
console.warn('Websocket reconnected'); console.warn('Websocket reconnected');
if (this.isRoomAvailable()) {
this.session.onRecoveredConnection();
} else {
alert('Connection error. Please reload page.');
}
} }
private isRoomAvailable(): boolean { private isRoomAvailable(): boolean {

View File

@ -869,6 +869,26 @@ export class Session implements EventDispatcher {
} }
} }
/**
* @hidden
*/
onRecoveredConnection(): void {
/*if (!this.connection) {
console.warn('Not connected to session: if you are not debugging, this is probably a certificate error');
const url = 'https://' + this.openvidu.getWsUri().split('wss://')[1].split('/openvidu')[0];
if (window.confirm('If you are not debugging, this is probably a certificate error at \"' + url + '\"\n\nClick OK to navigate and accept it')) {
location.assign(url + '/accept-certificate');
}
return;
}*/
console.warn('Recovered connection in Session ' + this.sessionId);
this.ee.emitEvent('connectionRecovered', []);
}
/** /**
* @hidden * @hidden
*/ */