Merge pull request #89 from techcouncilbox/master

Recovered connection event added to openvidu-browser
pull/87/merge
Pablo Fuente Pérez 2018-07-10 12:38:52 +02:00 committed by GitHub
commit 017e79fd8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
*/ */