What class should I override to change session settings and how to add it?

for example I don’t want anyone to be able to join the session if the game started, add some info like server/room name, current map and GameType/GameMode, stuff that’s also set inside lobby (changed before game starts but after joining session) like game length and difficulty etc and you should be able to get all just from the session result without joining one

There’s no need to override a class. SessionSettings is something like a dictionary so you can add any key value pair you want. So when you find a Session with a client, you can check the SessionSettings and the info you added will be there, so then you can do whatever you want based on it.

You can see eXi does it in this part of his tutorial about sessions.

bool UNWGameInstance::HostSession(TSharedPtr<const FUniqueNetId> UserId, FName SessionName, bool bIsLAN, bool bIsPresence, int32 MaxNumPlayers)
{
	// Get the Online Subsystem to work with
	IOnlineSubsystem* const OnlineSub = IOnlineSubsystem::Get();

	if (OnlineSub)
	{
		// Get the Session Interface, so we can call the "CreateSession" function on it
		IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();

		if (Sessions.IsValid() && UserId.IsValid())
		{
			/* 
				Fill in all the Session Settings that we want to use.
				
				There are more with SessionSettings.Set(...);
				For example the Map or the GameMode/Type.
			*/
			SessionSettings = MakeShareable(new FOnlineSessionSettings());

			SessionSettings->bIsLANMatch = bIsLAN;
			SessionSettings->bUsesPresence = bIsPresence;
			SessionSettings->NumPublicConnections = MaxNumPlayers;
			SessionSettings->NumPrivateConnections = 0;
			SessionSettings->bAllowInvites = true;
			SessionSettings->bAllowJoinInProgress = true;
			SessionSettings->bShouldAdvertise = true;
			SessionSettings->bAllowJoinViaPresence = true;
			SessionSettings->bAllowJoinViaPresenceFriendsOnly = false;

			SessionSettings->Set(SETTING_MAPNAME, FString("NewMap"), EOnlineDataAdvertisementType::ViaOnlineService);

			// Set the delegate to the Handle of the SessionInterface
			OnCreateSessionCompleteDelegateHandle = Sessions->AddOnCreateSessionCompleteDelegate_Handle(OnCreateSessionCompleteDelegate);

			// Our delegate should get called when this is complete (doesn't need to be successful!)
			return Sessions->CreateSession(*UserId, SessionName, *SessionSettings);
		}
	}
	else
	{
		GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, TEXT("No OnlineSubsytem found!"));
	}

	return false;
}

See the “SessionSettings->Set(SETTING_MAPNAME, FString(“NewMap”), EOnlineDataAdvertisementType::ViaOnlineService);” line?

He is doing it right there. You could do the same with any other piece of info. Also SessionSettings already has a boolean that prevents people from joining if the game has already started.

Hope this helps

Thank you for your answer, how can I add extra custom keys like time though, just put a name and a value in the ->set function?

Yup. And then when you find a session use the get function to retrieve the pair.

Here’s the link to the FOnlineSessionSettings class. It’s pretty straight forward
https://docs.unrealengine.com/latest/INT/API/Runtime/OnlineSubsystem/FOnlineSessionSettings/index.html

I read it but for example if I wanted SETTING_TIME instead of SETTING_MAPNAME and it takes a float instead of a String, where or how can I define that? In the GameInstance header and just use ->Set with it?

Yeah you just pass the key value pair to the Set function, pretty sure you can put floats in there too, or you could construct a FOnlineSessionSetting object with the values you want and just pass that to your FOnlineSessionSetings Set function.