Fixing disconnect call

This commit is contained in:
David Négrier
2020-09-29 09:45:47 +02:00
parent 6a4c0c8678
commit 2cea0e490b
2 changed files with 12 additions and 10 deletions
+7 -6
View File
@@ -66,13 +66,14 @@ enum SocketIoEvent {
}
function emitInBatch(socket: ExSocketInterface, payload: SubMessage): void {
if (socket.disconnecting) {
return;
}
socket.batchedMessages.addPayload(payload);
if (socket.batchTimeout === null) {
socket.batchTimeout = setTimeout(() => {
if (socket.disconnecting) {
return;
}
const serverToClientMessage = new ServerToClientMessage();
serverToClientMessage.setBatchmessage(socket.batchedMessages);
@@ -688,13 +689,13 @@ export class IoSocketController {
// TODO: REBUILD THIS
return;
if (socket.webRtcRoomId === roomId) {
/* if (socket.webRtcRoomId === roomId) {
return;
}
socket.join(roomId);
socket.webRtcRoomId = roomId;
//if two persons in room share
if (this.Io.sockets.adapter.rooms[roomId].length < 2 /*|| this.Io.sockets.adapter.rooms[roomId].length >= 4*/) {
if (this.Io.sockets.adapter.rooms[roomId].length < 2) {
return;
}
@@ -718,7 +719,7 @@ export class IoSocketController {
}, []);
client.emit(SocketIoEvent.WEBRTC_START, {clients: peerClients, roomId: roomId});
});
});*/
}
/** permit to share user position