NakamaUnreal realtime client notifications listener not working

We are using Unreal Engine 5.1 and nakama-unreal-2.7.0 client SDK, and we have implementation that is using UNakamaClient, UNakamaSession and UNakamaRealtimeClient classes.
On back-end we rpc that includes nk.NotificationSend(…) call (and notif. is persistent)
On client when NakamaClient->ListNotifications(…) is called, operation is successfully executed and list of all notifications.
We have tried to set notification listener after successful authentication:

NakamaRealtimeClient = NakamaClient->SetupRealtimeClient(NakamaSession, true, 7350, ENakamaRealtimeClientProtocol::Protobuf, 0.05f, "");
NakamaRealtimeClient->SetListenerNotificationsCallback();
TScriptDelegate NakamaNotificationDelegate;
NakamaNotificationDelegate.BindUFunction(this, GET_FUNCTION_NAME_CHECKED(ThisClass, HandleNakamaNotificationEvent));
NakamaRealtimeClient->NotificationReceived.Add(NakamaNotificationDelegate);
NakamaRealtimeClient->Connect(ConnectionSuccessDelegate, ConnectionErrorDelegate);

We receive in logs confirmation of websocket connection:

LogTemp: [NRtClient::NRtClient] Created
LogTemp: [NRtClient::connect] ...
LogTemp: Warning: Nakama Realtime Client Setup: Socket connected

We are implemented Nakama as:

class GAME_API UGameNakamaSubsystem : public UGameInstanceSubsystem
{
..
	UPROPERTY()
	UNakamaClient* NakamaClient;

	UPROPERTY()
	UNakamaSession* NakamaSession;

	UPROPERTY()
	UNakamaRealtimeClient* NakamaRealtimeClient;
..
}

We have Tick function:

bool UGameNakamaSubsystem::Tick(float DeltaSeconds)
{
	// You must tick Nakama client to get server response and events
	if (NakamaClient != nullptr)
	{
		NakamaClient->Tick(DeltaSeconds);
	}
	// You must tick Nakama real time client to get server response and events
	if (NakamaRealtimeClient != nullptr)
	{
		NakamaRealtimeClient->Tick(DeltaSeconds);
	}
	return true;
}

But when rpc (with NotificationSend) is executed, on our client bound function HandleNakamaNotificationEvent DOES NOT GET triggered.

Hi @danilo-sca

Could you share the code of the RPC? It would help understanding the issue.

func RpcMatchReward(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, payload string) (string, error) {
	userID, ok := ctx.Value(runtime.RUNTIME_CTX_USER_ID).(string)
	if !ok {
		return "", errNoUserIdFound
	}
...
	responseObject, err := json.Marshal(reward_response)
	if err != nil {
		logger.Error("Error marshaling response type to JSON: %v", err)
		return "", runtime.NewError("Cannon marshal type", INTERNAL)
	}
...
	subject := "You've received reward!"
	content := map[string]interface{}{
		"reward_color": current_reward_color,
		"color_count": current_color_count,
	}
	code := 1001
	senderID := "" // Empty string for server sent.
	persistent := true	
	err = nk.NotificationSend(ctx, userID, subject, content, code, senderID, persistent)
	if err != nil {
		logger.Error("NotificationsSend error: %v", err)
	}

	return string(responseObject), nil    
}

All notification are recorded on back-end side. We can retrieved them on client by making NakamaClient->ListNotifications(…) call, but notification listener on client does not react.

We also have problem with Status Presence delegate from NakamaRealtimeClient.cpp

..
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnReceivedStatusPresence, const FNakamaStatusPresenceEvent&, UserPresenceData);
..
UPROPERTY(BlueprintAssignable, Category = "Nakama|Events")
FOnReceivedStatusPresence PresenceStatusReceived;
..

In GameNakamaSubsystem.cpp we bind function HandleNakamaPresenceEvent to PresenceStatusReceived delegate.

NakamaRealtimeClient = NakamaClient->SetupRealtimeClient(NakamaSession, true, 7350, ENakamaRealtimeClientProtocol::Protobuf, 0.05f, "");
if (NakamaRealtimeClient != nullptr)
{
	NakamaRealtimeClient->SetListenerStatusPresenceCallback();

    FScriptDelegate NakamaPresenceDelegate;
	NakamaPresenceDelegate.BindUFunction(this, GET_FUNCTION_NAME_CHECKED(ThisClass, HandleNakamaPresenceEvent));
	NakamaRealtimeClient->PresenceStatusReceived.Add(NakamaPresenceDelegate);

	NakamaRealtimeClient->Connect(ConnectionSuccessDelegate, ConnectionErrorDelegate);
}

After successful realtime client connection we call:

NakamaRealtimeClient->UpdateStatus("Hello", SetStatusDelegate, RealtimeClientErrorDelegate);

And in logs we get:

LogOnline: Nakama Client Authenticated - user name: danilo.test
LogTemp: [NRtClient::NRtClient] Created
LogTemp: [NRtClient::connect] ...
LogTemp: Warning: Nakama Realtime Client Setup: Socket connected
LogOnline: Nakama WebSocket Setup Success!
LogTemp: [NRtClient::updateStatus] ...
LogTemp: Warning: User danilo.test now has status 
LogOnline: Warning: Nakama Realtime Client Set Status Success!
LogTemp: Warning: User danilo.test now longer has status 
LogTemp: Warning: User danilo.test now has status Hello

Based on those logs listener callbacks are set UNakamaRealtimeClient::SetListenerStatusPresenceCallback()
So, status of user gets updated, listeners react, but it looks like there is problem with
PresenceStatusReceived.Broadcast(event);
As our function HandleNakamaPresenceEvent is never called.

Do we bind to PresenceStatusReceived delegate properly?
Is there something more to be done?
Binding code that we used is also used on many other places in our code and it is working.

I have discovered reason why delegates where not working.
I did not put UFUNCTION() above bonded functions.

You can close this issue.