Update Session Settings not working

I need to update a session. The session is full and inprogress, it can’t be joined anyway but its still found in session searches. I therefore need to deactive advertise.

||FOnlineSessionSettings NewSessionSettings;
||NewSessionSettings.bIsLANMatch = true;
||NewSessionSettings.bShouldAdvertise = false;
||OnlineSubsystem->GetSessionInterface()->UpdateSession(Game, NewSessionSettings);

In the API it states

returns true if successful creating the session, false otherwise

It return true, I expected it to update the existing session and not creating a new one. Either way, the one and only session is not updated.
So how to update a session?

First things first, is “Game” your session name? If so, you are doing it wrong. SessionName is not the name of the session. It’s the name (id) of the NamedSession created internally, so it’s more like a session type. It should either be GameSessionName or PartySessionName. Make sure to use these when creating/joining/destroying/updating sessions.

Another thing is registering players. AGameSession is set up to register players automatically for GameSessionName. So it’s possible that you aren’t actually registering players anywhere, and the subsystem only sees the session as 1/4 players for example. Also keep in mind that updating a session takes time to complete. So if you are opening a new level right after calling UpdateSession(), it’s possible that nothing will happen at all.

Thank you for your answer.
Yes Game is my Sessionname, I followed this post. You say this is outdated or wrong. So the sessionname is basically an enum with GameSessionName or PartySessioName if I got you correctly. I’ve now set it to GameSessionName. And also waited a longer time, still it shows up.
Conserning the registration, since the players can’t join anymore, I think the players are registered.
Thanks again.

To further clarify. GameSessionName and PartySessionName are macros, and they should append to NAME_GameSession and NAME_PartySession. I’m not sure if these names will further append to something else but I’m 100% confident that you are supposed to use the macros.

Back to your issue though. There is a console command ‘DumpOnlineSessionState’ that you can use to check the state of your sessions, but ironically enough it stops working for me as soon as I connect to a host. So if you want to check if your session is advertised or not, do it like so:

FOnlineSessionSettings* MySession = SessionInterface->GetSessionSettings(GameSessionName);
if (MySession)
	// MySession->bShouldAdvertise
1 Like

And yes you are 100% right. I’ve finally found the macro and it works. Thanks a lot.
The param commet:
@param SessionName the name to use for this session so that multiple sessions can exist at the same time
Has led me to the completely wrong track. It sounds like this is different for each implementation of the OnlineSessionInterface? Is that correct?

The session name? No, I think every OSS uses the same macros. ‘multiple sessions’ refers to you having a game session and a party session at the same time. Though I have to say that so far I don’t understand how that works. I had issues when I attempted to register a player into a game session who’s already registered in a party session.

1 Like