mirror of https://github.com/OpenVidu/openvidu.git
openvidu-browser: Checked remoteConections size before find into it
When two connections close at the same time, it shows the following error : OpenVidu Error Remote connection unknown when 'onParticipantLeft'. Existing remote connections: [] it has been avoided checking if remoteConnections is not emptypull/609/head
parent
c0f1e1d6fb
commit
ce6beac85d
|
@ -731,28 +731,29 @@ export class Session extends EventDispatcher {
|
||||||
*/
|
*/
|
||||||
onParticipantLeft(msg): void {
|
onParticipantLeft(msg): void {
|
||||||
|
|
||||||
this.getRemoteConnection(msg.connectionId).then(connection => {
|
if(this.remoteConnections.size > 0) {
|
||||||
if (!!connection.stream) {
|
this.getRemoteConnection(msg.connectionId).then(connection => {
|
||||||
const stream = connection.stream;
|
if (!!connection.stream) {
|
||||||
|
const stream = connection.stream;
|
||||||
|
|
||||||
const streamEvent = new StreamEvent(true, this, 'streamDestroyed', stream, msg.reason);
|
const streamEvent = new StreamEvent(true, this, 'streamDestroyed', stream, msg.reason);
|
||||||
this.ee.emitEvent('streamDestroyed', [streamEvent]);
|
this.ee.emitEvent('streamDestroyed', [streamEvent]);
|
||||||
streamEvent.callDefaultBehavior();
|
streamEvent.callDefaultBehavior();
|
||||||
|
|
||||||
this.remoteStreamsCreated.delete(stream.streamId);
|
this.remoteStreamsCreated.delete(stream.streamId);
|
||||||
|
|
||||||
if (this.remoteStreamsCreated.size === 0) {
|
if (this.remoteStreamsCreated.size === 0) {
|
||||||
this.isFirstIonicIosSubscriber = true;
|
this.isFirstIonicIosSubscriber = true;
|
||||||
this.countDownForIonicIosSubscribersActive = true;
|
this.countDownForIonicIosSubscribersActive = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
this.remoteConnections.delete(connection.connectionId);
|
||||||
this.remoteConnections.delete(connection.connectionId);
|
this.ee.emitEvent('connectionDestroyed', [new ConnectionEvent(false, this, 'connectionDestroyed', connection, msg.reason)]);
|
||||||
this.ee.emitEvent('connectionDestroyed', [new ConnectionEvent(false, this, 'connectionDestroyed', connection, msg.reason)]);
|
})
|
||||||
})
|
.catch(openViduError => {
|
||||||
.catch(openViduError => {
|
logger.error(openViduError);
|
||||||
logger.error(openViduError);
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue