Close previous client socket if uuid client socket already exist

This commit is contained in:
Gregoire Parant 2020-10-22 11:26:01 +02:00
parent b7d883b2e7
commit 367afa511b

View file

@ -159,6 +159,13 @@ export class IoSocketController {
}
const userUuid = await jwtTokenManager.getUserUuidFromToken(token);
let client = socketManager.searchClientByUuid(userUuid);
//if client socket exist, close connexion
if(client){
console.info(`Close connexion, client with uuid : ${userUuid} already exist !`);
socketManager.emitCloseMessage(client, 500);
socketManager.leaveRoom(client);
}
let memberTags: string[] = [];
let memberTextures: CharacterTexture[] = [];