Presence Reference #

Presence SDK #

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

Calldescription
SetAsOnlineAppear as “online” to friends in the game instance
SetAsAwayAppear as “away” to friends in the game instance
SetRichPresenceSet rich presence
SetPresenceSet basic presence and rich presence at the same time
GetPresenceRetrieve presence status for current player

The Presence Plugin #

The Presence Plugin provides a location for developers to implement custom presence functionality, such as handling the rich presence ext. The Presence Tasks topic shows example usage of the Presence Plugin methods, along with the SDKs that invoke them.

Presence class #

propertydescription
socialIdUnique social identifier for the player (game agnostic)
playerIdUnique player ID
gameShardIdUnique identifier of the game shard associated with this presence object
gameTitleIdTitle of the game associated with the gameShardId. See Game Title Management in the Portal documentation for more information of game shard/game title mapping.
basicPresenceBasicPresence object representing whether the user appears “online” or “away”. See following table.
extCustom ExtRichPresence payload containing custom data to display to friends

Basic presence enum #

propertydescription
onlineUser’s presence status is “online”
awayUser’s presence status is “away”

Extension data #

You can use Extension Data (exts) to define custom data about player presence statuses. See Presence Tasks for sample implementation.

The following table lists the ext payloads relevant to presence information.

extdescriptionexample data
ExtRichPresencePlayerRequestCustom presence values set/updated by the player clientcustom away message
ExtRichPresenceBackendRequestCustom presence values set/updated by the game servercurrent score

Configuration #

The FriendsServiceConfig configuration block provides a place to define default values for the Friend and Presence services.

The following configuration values are related to Presence features:

configdescription
enablePresenceUpdatesEnable or disable ability to update presence statuses. If false, a player’s basic and rich presences cannot be updated. The Presence API’s GetPresence method is still available and will return presence values (if any) at the time enablePresenceUpdates was set to false.

Default: true

See Friend Reference for information on other configuration values.

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 new Presence
OnFriendUpdatedA friend’s presence status changesFriend
OnFriendListChangedA friend is added or removed from your list, or a friend’s presence status changesFriend
If Pragma Engine detects an OnFriendUpdated event was missed due to network issues, the entire friend list is fetched again. Older OnFriendUpdated notifications are ignored.

Errors #

  • Presence_GameIdentityNotFound
  • Presence_PresenceNotFound