init()
method, the logged-in user will receive the presence for the other users in the app.
In the AppSettings
class, you can set the type of Presence you wish to receive for that particular session of the app.
For presence subscription, the AppSettingsBuilder provides 3 methods :
subscribePresenceForAllUsers()
- this will inform the logged-in user when any user in the app comes online or goes offlinesubscribePresenceForRoles(Array roles)
- This will inform the logged-in user, only when the users with the specified roles come online or go offline.subscribePresenceForFriends()
- This will inform the logged-in user, only when either of his friends come online or go offline.UserListener
using the addUserListener()
method where ever you wish to receive these events in.
Parameter | Description |
---|---|
listenerID | An ID that uniquely identifies that listener. |
User
class in the listener methods.
We recommend you remove the listener when not in use.
We suggest removing listener in componentWillUnmount() method when not in use.
status
- This will hold either of the two values :lastActiveAt
- in case the user is offline, this field holds the timestamp of the time when the user was last online. This can be used to display the Last seen of the user if need be.