FindSessionById in Online Subsystem Steam

Hi all,

I’m running a 4.26 source build, and I want to enable a player to join a game directly from a Steam friends list or through a Steam invite. I already have this working if the invitee is already running the game, but I would also like the player to be able to join a session directly without having the game open first.

If the game is launched from an invitation or request to join a lobby, then UE4 starts with the +connection_lobby parameter set. From this I can get the unique ID for the session that needs to be joined. So far so good.

Where I run into problems however is that I need a search result in order to call the Session Interface’s “JoinSession” function. This means I need to find the session first then join it. There is a “FindSessionById” function which would be ideal, but in the Steam session interface the function is stubbed out and does nothing:

bool FOnlineSessionSteam::FindSessionById(const FUniqueNetId& SearchingUserId, const FUniqueNetId& SessionId, const FUniqueNetId& FriendId, const FOnSingleSessionResultCompleteDelegate& CompletionDelegates)
FOnlineSessionSearchResult EmptyResult;
CompletionDelegates.ExecuteIfBound(0, false, EmptyResult);
return true;

Does anyone know how I’m supposed to get this working? It’s not the end of the world if this kind of functionality is just not supported in UE4, but it would have been a nice feature to allow someone to ping their friend an invite and allow them to jump right in even if they don’t have the game running at the time.


It’s great isn’t it? I don’t know why such a core functionality isn’t implemented by default. Anyways, assuming that the LobbyId is the same as a search result’s session id, you can have the session id “broadcasted” via a session setting. You can add it after the session is created. When you are preparing to search, you can add a query setting that compares against the session id. So in theory, there will be only one search result. The one that you are looking for.

Interesting idea, thanks! Another thing I might try is creating a fake search result, though given all I have is the lobby ID, I might not have enough info to create a valid search result.

Its a shame that an invite doesn’t pass in the friend’s ID as well, as I could have just done a simple search by friend (unless that’s stubbed out too…). Oh well!

Ok it struck me that another problem is if a player wants to host a private session which isn’t advertised. This would make it impossible to retrieve the session in any search. In the absence of being able to just directly connect to a Lobby ID, I think for now I will not bother stressing too much about joining someone direct from Steam. I can focus on allowing players to send invites from in game instead.

Annoying, but what can you do other than start messing with the murky world of Steam APIs and UE4 networking :frowning: