Skip to main content
Track whether users are online or offline in real-time.

Real-time Presence

Configure presence subscription in AppSettings during SDK initialization. The AppSettingsBuilder provides three subscription options: If none of these methods are called, no presence events will be delivered.
You must configure presence subscription in AppSettings during CometChat.init() before any presence events will be delivered. See Setup SDK for details.
Register a UserListener to receive presence events:
Each callback receives a User object with presence information. Relevant fields to access on returned users:
Presence events are triggered for other users, not for yourself. For example, if User 1 is logged in and User 2 comes online, User 1 receives onUserOnline for User 2. Neither User 1 nor User 2 receive presence events for their own status changes — only for others.
Remove the listener when no longer needed:
Always remove your UserListener when the component or view unmounts to prevent memory leaks and duplicate event handling.

User List Presence

When fetching users via UsersRequest, each User object includes presence fields:

Next Steps

Retrieve Users

Fetch user lists with filtering and pagination.

User Management

Create and update users programmatically.

Block Users

Block and unblock users to control communication.

SDK Setup

Configure AppSettings including presence subscriptions.