Skip to main content
All CollectionsPortal-X Pages
Design | Messaging | Presence
Design | Messaging | Presence

RTT presence configurations

Jason Liang avatar
Written by Jason Liang
Updated over 7 months ago

Online Presence allows an app’s users to know which of their friends are currently online, what they are doing, and whether they are available to interact. See the example below that shows the Presence activity of friends on the Main Menu of the brainCloud Bombers example.

Configs messaging service:

  • To make RTT Presence work, you need to enable RTT on the Design | Core App Info | Advanced Settings page first. Make sure the Real-time Tech (RTT) Enabled is checked.

  • Navigate to the Design | Messaging | Presence Config page, and enable presence service for your app by checking the first checkbox. Fill in all the required fields respectively. Click the Save button to complete your configuration.

Test:

  • Download the Unity test example from here. Unzip it and open it with Unity Hub.

  • Test from the editor as below or build it into any platform that fits your test device.

  • Logging your app from the brainCloud setting tab:

  • Run the game, fill in the [User Name] and [Password] input fields with any words you prefer, and click the Auth button, you will see the success return like below.

  • Click enableRTT button from your Unity app, you should see the return below with RTT connect success info.

  • Go to the brainCloud portal login to the same app as above, find page Design | Cloud Code | API Explorer, and authenticate with a different user from above.

  • Select Presence Service and SysInitializePresence Operation, put the profileId of the current portal login user, and set the "activity" with "status": "waiting" as below:

  • Switch to Unity editor/app, paste the profiled that you got from the portal on the above step to profile id input box, then click the register Listener for profile: button. You will see the return as below with the presence listener registered success info. Check the activity and summaryFriendData of the portal user, these data will be changed later on.

  • Now, go back to the brainCloud portal API Explorer page, select Presence Service and UpdateActivity Operation, and set the "activity" with "status": "palying..." as below:

  • You should find your Unity editor/app incoming screen is auto-refreshed with the new "status" of "activity" as "playing..." for the above portal user.

  • Now, let's change the "summaryFriendData" of the current portal login user. Select PlayerState Service and UpdateSummaryFriendData Operation, set the "summaryFriendData" as below, hit Run.

  • Select Presence Service and ForcePush Operation, and hit Run.

  • You should find this portal user's new "summaryFriendData" is auto-refreshed on the screen of your Unity editor/app.

Did this answer your question?