# How to find Online Sessions in Crossgen SDK

**URL:** <https://forums.unrealengine.com/t/how-to-find-online-sessions-in-crossgen-sdk/2275367>\
**Category:** Programming & Scripting\
**Tags:** onlinesubsystem, PS5, unreal-engine, CPP\
**Created:** [January 13, 2025, 7:57pm UTC](https://forums.unrealengine.com/t/how-to-find-online-sessions-in-crossgen-sdk/2275367 "2025-01-13T19:57:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PortingBromio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PortingBromio](https://forums.unrealengine.com/u/PortingBromio)\
**Post date:** [January 13, 2025, 7:57pm UTC](https://forums.unrealengine.com/t/how-to-find-online-sessions-in-crossgen-sdk/2275367/1 "2025-01-13T19:57:57Z")

</div>

Hi! I’ve been trying to make online sessions work for a while now and I’m stuck with some things.

After a lot of research I found some kind of “guides” about how to look for a session and I was trying to use this code in the OnlineSessionInterfaceCrossgen.cpp file (as Find Sessions is not implemented in this script) and everything seems ok in most things, but when I try to build the project I get this error message:

"assigning to ‘FDelegateHandle(FOnlineSessionCrossgen::\*)(bool)’ from incompatible type ‘FDelegateHandle’ "

My handles are:

```auto
FDelegateHandle OnFindSessionsCompleteDelegateHandle;

// The delegate executed by the online subsystem
FOnFindSessionsCompleteDelegate FindSessionsCompleteDelegate;

```

and the FindSessions code is:

```auto
bool FOnlineSessionCrossgen::FindSessions(const FUniqueNetId& SearchingPlayerId, const TSharedRef<FOnlineSessionSearch>& SearchSettings)
{
	UE_LOG_ONLINE(Log, TEXT("Implementing FindSessions for PS5"));

	FOnlineAsyncTaskGetSessionByIdComplete TaskCompletionDelegate;
	SessionSearchSettings = SearchSettings;

	IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
	if (OnlineSub) {
		IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();

		if (Sessions.IsValid() && SearchingPlayerId.IsValid()) {
			FDelegateHandle(FOnlineSessionCrossgen::* OnFindSessionsCompleteDelegateHandle)(bool);

			//FindSessionsCompleteDelegate = (FOnFindSessionsCompleteDelegate::CreateUObject(this, &FOnlineSessionCrossgen::OnFindSessionsComplete));
			OnFindSessionsCompleteDelegateHandle = Sessions->AddOnFindSessionsCompleteDelegate_Handle(FindSessionsCompleteDelegate);
			Sessions->FindSessions(SearchingPlayerId, SessionSearchSettings);

		}
	}
	else {
		FOnlineSessionCrossgen::OnFindSessionsComplete(false);
	}
	
	return true;
}

```

I’ve already created the handle in the constructor (that’s why it’s commented in the function), this error message comes from the line

OnFindSessionsCompleteDelegateHandle = Sessions → AddOnFindSessionsCompleteDelegate\_Handle…

Is there something I’m doing wrong or missing in this?

Thanks a lot to anyone who can offer some light to this

---

<div class="post-metadata">

**Author:** ![PortingBromio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PortingBromio](https://forums.unrealengine.com/u/PortingBromio)\
**Post date:** [January 21, 2025, 7:55pm UTC](https://forums.unrealengine.com/t/how-to-find-online-sessions-in-crossgen-sdk/2275367/2 "2025-01-21T19:55:04Z")

</div>

To anyone nterested, I’ve managed to fix the specific build error issue by changing the assign delegate line by declaring the handle in the same function.

> FDelegateHandle findSessionsCompleteDelegateHandle = Sessions-\>AddOnFindSessionsCompleteDelegate\_Handle(FindSessionsCompleteDelegate);

The build finished succesfully, but it crashed on startup because of the TSharedRef variable, it seems that one cannot use a variable of this kind as part of a class, the game crashed when it got to the constructor of this class. I tested different things and changed the variable to a TSharedPtr, but whenever I get to the line that sends the FindSessions message (Sessions-\>FindSessions(SearchingPlayerId, SessionSearchSettings); ) the game crashes, I’m still trying to figure out what is happening here and how I can work around this, if anyone has any clue or solution, I would love to be pointed in the right direction
