Interface representing a user in the MigratoryData cluster.
Public Functions
Name | |
---|---|
String | getExternalToken() Get the external token of the user. |
long | getSessionId() Get the session id assigned by the MigratoryData server to the user. |
List |
getSubjects() Get the list of subscribed subjects by the user. |
boolean | isOffline() Determine if the user is offline. |
Map<String,Object> | getAdditionalInfo() Get additional attributes of the user as key/value pairs. |
Public Functions Documentation
function getExternalToken
String getExternalToken()
Get the external token of the user. This external token should be provided on the client-side using the following client method:
/**
* Assigns an external token to enable client communication via
* external services while the client is offline.
*
* Presuming a client goes offline and disconnects from the
* MigratoryData cluster. Then plugins within the MigratoryData
* server, leveraging MigratoryData's Presence API, can utilize
* this external token to communicate with the offline client,
* via external services like push notifications or email.
*
* For instance, consider a plugin designed for Firebase Cloud
* Messaging (FCM), which requires an FCM token to send push
* notifications to a client via FCM. Through this method, the
* client can provide the necessary FCM token to the plugin.
*
* Similarly, consider a plugin designed for email services. To
* send emails to clients when they're offline, the plugin requires
* their email addresses. Clients can provide their email addresses
* using this method.
*
* @param externalToken a token (e.g. FCM token, email address, ...)
*/
public void setExternalToken(String externalToken);
Return: the external token of the user.
function getSessionId
long getSessionId()
Get the session id assigned by the MigratoryData server to the user.
Return: the session id of the user.
function getSubjects
List< String > getSubjects()
Get the list of subscribed subjects by the user.
Return: the list of subscribed subjects of the user.
function isOffline
boolean isOffline()
Determine if the user is offline.
Return: true if the user is offline, and false otherwise.
function getAdditionalInfo
Map< String, Object > getAdditionalInfo()
Get additional attributes of the user as key/value pairs.
The following attributes are currently available:
- address: the Internet address of the user
- entitlementToken: the entitlement token of the user assigned by the client library
- local: indicate whether the user presence event originates from the local cluster member or has been received from another cluster member as part of cluster-wide presence replication
Return: a map with additional attributes of the user presence event.