Enter the presence set
To enter the presence set of a channel, use theenter() method:
Subscribe to presence events
Subscribe to presence events to be notified when members enter, leave, or update their status:Subscribe to specific presence events
You can subscribe to specific presence event types:Presence events
The following presence events are emitted:| Event | Description |
|---|---|
| enter | A new member has entered the channel |
| leave | A member who was present has now left the channel |
| update | An already present member has updated their member data |
| present | When subscribing to presence events on a channel that already has members present, this event is emitted for every member already present on the channel |
Update presence data
Members can update their presence data at any time:Leave the presence set
To explicitly leave the presence set:Get the current presence set
Retrieve the current members of the presence set:Presence with multiple devices
A singleclientId can be present multiple times on the same channel via different connections. For example, if a user is connected on both mobile and desktop:
Presence history
You can retrieve historical presence events:Best practices
Keep presence data small
Presence data is transmitted to all subscribers, so keep it minimal:Use presence.get() efficiently
Instead of maintaining your own list of members, callpresence.get() when needed:
Next steps
- Learn about occupancy for high-level metrics
- Explore presence history
- Understand identified clients
