function RegisterUserName(socket, Data) {
  var userName = Data.UserName.split('>').join(' ').split('<').join(' ').split('/').join(' ');
  if (userName.length > 16) userName = userName.slice(0, 16);
  if (userName.toLowerCase().includes('você')) userName = '~' + userName;
  ActiveRooms.forEach((element, index) => {
    if (element.Id === Data.RoomId) {
      ActiveRooms[index].Players.forEach((element2, index2) => {
        if (element2.Name.toLowerCase() === userName.toLowerCase()) {
          console.log('UserName already exists');
          return socket.emit('UserNameAlreadyExists');
        } else if (element2.Id === Data.UserId) {
          ActiveRooms[index].Players[index2].Name = userName;
        }
        socket.emit('UserNameInformation', JSON.stringify({ RoomId: element.Id, UserId: element2.Id, NickName: element2.Name }));
      });
    }
  });
}
Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.