Fix webrtc back
- Add refuse to join if webrtc room have 4 players.
This commit is contained in:
parent
8fb9053412
commit
16cf33755c
@ -172,6 +172,9 @@ export class IoSocketController {
|
|||||||
Client.broadcast.emit(SockerIoEvent.WEBRTC_DISCONNECT, JSON.stringify({
|
Client.broadcast.emit(SockerIoEvent.WEBRTC_DISCONNECT, JSON.stringify({
|
||||||
userId: Client.userId
|
userId: Client.userId
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
//disconnect webrtc room
|
||||||
|
Client.leave(Client.webRtcRoomId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,7 +189,7 @@ export class IoSocketController {
|
|||||||
socket.join(roomId);
|
socket.join(roomId);
|
||||||
socket.webRtcRoomId = roomId;
|
socket.webRtcRoomId = roomId;
|
||||||
//if two persone in room share
|
//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;
|
return;
|
||||||
}
|
}
|
||||||
let clients: Array<any> = Object.values(this.Io.sockets.sockets);
|
let clients: Array<any> = Object.values(this.Io.sockets.sockets);
|
||||||
|
Loading…
Reference in New Issue
Block a user