Fix webrtc back

- Add refuse to join if webrtc room have 4 players.
This commit is contained in:
gparant 2020-05-08 11:16:49 +02:00
parent 8fb9053412
commit 16cf33755c

View file

@ -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<any> = Object.values(this.Io.sockets.sockets);