diff --git a/back/src/Controller/IoSocketController.ts b/back/src/Controller/IoSocketController.ts index 64012349..d253cc9e 100644 --- a/back/src/Controller/IoSocketController.ts +++ b/back/src/Controller/IoSocketController.ts @@ -172,6 +172,9 @@ export class IoSocketController { Client.broadcast.emit(SockerIoEvent.WEBRTC_DISCONNECT, JSON.stringify({ userId: Client.userId })); + + //disconnect webrtc room + Client.leave(Client.webRtcRoomId); } /** @@ -186,7 +189,7 @@ export class IoSocketController { socket.join(roomId); socket.webRtcRoomId = roomId; //if two persone in room share - if (this.Io.sockets.adapter.rooms[roomId].length < 2) { + if (this.Io.sockets.adapter.rooms[roomId].length < 2 || this.Io.sockets.adapter.rooms[roomId].length >= 4) { return; } let clients: Array = Object.values(this.Io.sockets.sockets);