Skip to main content

Incoming Friend Notifications

Last updated on

When a player sends a friend request to another player, the receiver will get an incoming friend request notification. You'll need to set up a delegate to enable this notification. Use the following function to implement the delegate for incoming friend request notifications.

FRegistry::Lobby.Connect();
FRegistry::Lobby.SetOnIncomingRequestFriendsNotifDelegate(AccelByte::Api::Lobby::FRequestFriendsNotif::CreateLambda([](const FAccelByteModelsRequestFriendsNotif& Result)
{
// Do something if OnIncomingRequestFriendsNotifDelegate has been successful
}));

Accepted Friend Request Notification

Use the following function to set up a notification for when your friend accepts your friend request.

FRegistry::Lobby.Connect();
FRegistry::Lobby.SetOnFriendRequestAcceptedNotifDelegate(AccelByte::Api::Lobby::FAcceptFriendsNotif::CreateLambda([](const FAccelByteModelsAcceptFriendsNotif& Result)
{
// Do something if OnFriendRequestAcceptedNotifDelegate has been successful
}));

Rejected Friend Request Notification

Use the following function to set up a notification for when a player rejects your friend request.

FRegistry::Lobby.Connect();
FRegistry::Lobby.SetOnRejectFriendsNotifDelegate(AccelByte::Api::Lobby::FRejectFriendsNotif::CreateLambda([](const FAccelByteModelsRejectFriendsNotif& Result)
{
// Do something if OnRejectFriendsNotifDelegate has been successful
}));

Canceled Outgoing Friend Request Notification

Use the following function to set up a notification when another player cancels their friend request.

FRegistry::Lobby.Connect();
FRegistry::Lobby.SetOnCancelFriendsNotifDelegate(AccelByte::Api::Lobby::FCancelFriendsNotif::CreateLambda([](const FAccelByteModelsCancelFriendsNotif& Result)
{
// Do something if OnCancelFriendsNotifDelegate has been successful
}));

Unfriend Notification

Use this function to set up a notification when a player unfriends another player.

FRegistry::Lobby.SetOnUnfriendNotifDelegate(AccelByte::Api::Lobby::FUnfriendNotif::CreateLambda([](const FAccelByteModelsUnfriendNotif& Result)
{
// Do something if OnUnfriendNotifDelegate has been successful
}));