Social API Reference #

This section provides references for methods and events in the Pragma Social APIs for Unreal and Unity. For information on Pragma Engine backend classes and plugins, see Social Backend Reference.

Pragma provides the following APIs that developers can use to facilitate social-related processes:

APIused byexample tasks
FriendApiPlayer clientSend a friend request
PresenceApiPlayer clientSet rich presence value

Friend API #

The table below contains a list of the API methods relevant to the Friend service. These methods are available via the FriendApi.

Methods #

methoddescription
AcceptFriendInvite()Accepts a friend invite. Inviter and invitee are added to each other’s friend list
BlockAllows a player top block another player from sending them invites by adding them to a blocklist
DeclineFriendInvite()Declines a friend invite
DisableIncomingFriendInvites()Prevents a player from receiving friend invites
EnableIncomingFriendInvites()Allows player to receive friend invites
ForceSync()Forcibly synchronizes the player client FriendApi with the friend information in the Pragma Engine backend
GetFriends()Retrieves a list of Friend objects in a player’s friend list
GetReceivedInvites()Retrieves a list of Friend Overview objects representing players whose friend invites you have not yet accepted/rejected
GetSentInvites()Retrieves a list of Friend Overview objects representing players who have not responded yet to your friend invites
GetBlockedList()Retrieves a list of Friend Overview object representing players who are blocked from sending the player a friend invite
Initialize()Initializes the Friend API. Required to use the Friend SDK functions.
RemoveFriend()Removes a friend from your friend list using the friend’s social ID
SendFriendInviteByDisplayName()Sends an invite using the invitee’s display name
SendFriendInviteBySocialId()Sends an invite using the invitee’s social ID
Unblock()Removes a player from another player’s blocklist, allowing the unblocked player to send the unblocker friend invites

Events #

There are several friend-related events that player clients can listen to. The following table describes the bindable events relevant to the Friend service.

The following events are handled by the player client.

EventTriggerData returned
OnFriendsListChangedA friend is added or removed from a player’s friend list, or a friend’s presence status changeslist of Friends on your friend list
OnFriendUpdatedA friend’s presence status changesFriend
OnSentInvitesChangedThe status of a sent invite changeslist of FriendOverview for pending sent invites
OnReceivedInvitesChangedThe status of a received invite changeslist of FriendOverviews for pending received invites
OnBlockedListChangedAn account is added or removed from the player’s blocklistlist of FriendOverviews for accounts on your blocklist
OnFriendInviteReceivedA player receives an inviteFriendOverview
OnFriendInviteAcceptedAn invitee accepts a friend inviteFriendOverview
OnFriendInviteDeclinedAn invitee declines a friend inviteFriendOverview
OnRemovedAsFriendA player is removed from another player’s friend listFriend
OnIncomingFriendInvitesEnabledChangedA player’s ability to receive invites changestrue/false
If notifications from the engine are received out of order due to a network issue, the friend cache will automatically refresh and the ‘On Changed’ events will be broadcasted.

Presence API #

The table below contains a list of the SDK methods relevant to the presence feature. These methods are available via the PresenceApi.

Methods #

methoddescription
Initialize()Initializes the Presence API. Required to use the Presence SDK functions.
SetAsOnline()Appears as “online” to friends in the game instance
SetAsAway()Appears as “away” to friends in the game instance
SetRichPresence()Sets rich presence
SetPresence()Sets basic presence and rich presence at the same time
GetPresenceCache()Retrieves presence status for current player
ForceSync()Forcibly synchronizes the player client PresenceApi with the presence information in the Pragma Engine backend

Events #

The following events are related to the Presence feature.

To optimize server-load management, Pragma engine only sends Presence-related events to friends who are online.

EventTriggerData returned
OnPresenceChangedYour presence status changesthe updated Presence