From 16cf33755ce586f906a21e83c3880c02bbd02492 Mon Sep 17 00:00:00 2001 From: gparant Date: Fri, 8 May 2020 11:16:49 +0200 Subject: [PATCH] Fix webrtc back - Add refuse to join if webrtc room have 4 players. --- back/src/Controller/IoSocketController.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);