Presence State


Presence state is a vital aspect of any modern application, acting as a driving factor for engagement products by showing the user's current availability. The AmitySDK supports both observing and notifying the presence of users, analogous to being online and observing users' online statuses.

Presence Setting

AmitySDK offers specific methods that allow the logged-in user to enable, disable, or query about presence settings. When these presence settings are enabled, the user is prepared to synchronize their presence state with the server.

Users can enable or disable their presence state feature. Disabled users will be considered offline and cannot use any presence-related functionalities. Network-level settings can also affect this feature.

Presence State feature is disabled by default at both the network and user levels. Please consult with Amity Team to enable this feature on the network level.

Enable Presence Status

The SDK user can invoke the enable() method within client.presence to activate their presence status.

Disable Presence Status

The SDK user can invoke the disable() method within client.presence to deactivate their presence status. When disabled, the user will be unable to sync both their own heartbeat and the presence of other users in the network. This action also halts any ongoing heartbeat synchronization processes.

Query Presence Status

The SDK user can invoke the isEnabled() method within client.presence to check their presence status. This method also determines if the presence state feature is available for the app. If unavailable, isEnabled() returns false. If the feature is available, the method checks the user-level settings, which are managed through the enable() and disable() methods as previously described.

Last updated