Online/Offline status of Friends

I want to ask if there is any option to get a notification/callback about the Online status of my following friend.

First, we get the friendlist:

Client->GetFriends(Session, Limit, FriendshipState, Cursor, GetFriendsSuccessDelegate, GetFriendsErrorDelegate);

where we get Online status:

FNakamaFriendList->NakamaUsers->NakamaUser->Online // Indicates whether the user is currently online

This is fine, we know if there friend is online or offline.
We also use the Following. We follow all our friends:

RealtimeClient->FollowUsers({ Friends.NakamaUsers[i].NakamaUser.Id }, FollowUsersSuccessDelegate, FollowUsersErrorDelegate);

Now, we can get notifications when my friend change the status. We are using

void SetStatusPresenceCallback(const TFunction<void(const FNakamaStatusPresenceEvent&)>& Callback) { OnStatusPresenceEvent = Callback; }

But it is only about the Presence and switching to Online state.
But we need to catch cases when our friend has connection problems or his game crashes.
In this case, the RealTimeClient knows that the friend was disconnected, right?
We can call GetFriends again and check the FNakamaFriendList->NakamaUsers->NakamaUser->Online, but it’s not nice. We need to have timer and call GetFriends in the cycle.

We need a notification/callback if the following friend is disconnected. Does there exist any option how to do this? Or is it possible to add a similar callback for this feature?


  1. Versions: Nakama Unreal 2.9.4
  2. Nakama Server 3.18.0

Hello @j4c0b,

you can detect if a user is disconnected in your callback by checking if there is a Presence leave event for that user (user left its Online status), and there is no corresponding new status.
This is described here.

ok. thanks, working after the fix: fix deserialization of StatusPresenceEvent by jsmidmfg · Pull Request #113 · heroiclabs/nakama-unreal · GitHub