Method to join room presence, will emit an enter event to all subscribers. Repeat calls will trigger more enter events.
Optional
data: unknownThe users data, a JSON serializable object that will be sent to all subscribers.
or upon failure, the promise will be rejected with an Ably.ErrorInfo object which explains the error.
Method to get list of the current online users and returns the latest presence messages associated to it.
Optional
params: RealtimePresenceParamsParameters that control how the presence set is retrieved.
or upon failure, the promise will be rejected with an Ably.ErrorInfo object which explains the error.
Method to check if user with supplied clientId is online
The client ID to check if it is present in the room.
or upon failure, the promise will be rejected with an Ably.ErrorInfo object which explains the error.
Method to leave room presence, will emit a leave event to all subscribers. If the user is not present, it will be treated as a no-op.
Optional
data: unknownThe users data, a JSON serializable object that will be sent to all subscribers.
or upon failure, the promise will be rejected with an Ably.ErrorInfo object which explains the error.
Subscribe the given listener from the given list of events.
Note: This requires presence events to be enabled via the enableEvents
option in
the PresenceOptions provided to the room. If this is not enabled, an error will be thrown.
{'enter' | 'leave' | 'update' | 'present'} single event name or array of events to subscribe to
Optional
listener: PresenceListenerlistener to subscribe
An Ably.ErrorInfo with code 40000 if presence events are not enabled
Subscribe the given listener to all presence events.
Note: This requires presence events to be enabled via the enableEvents
option in
the PresenceOptions provided to the room. If this is not enabled, an error will be thrown.
Optional
listener: PresenceListenerlistener to subscribe
An Ably.ErrorInfo with code 40000 if presence events are not enabled
Method to update room presence, will emit an update event to all subscribers. If the user is not present, it will be treated as a join event.
Optional
data: unknownThe users data, a JSON serializable object that will be sent to all subscribers.
or upon failure, the promise will be rejected with an Ably.ErrorInfo object which explains the error.
This interface is used to interact with presence in a chat room: subscribing to presence events, fetching presence members, or sending presence events (join,update,leave).
Get an instance via Room.presence.