RealtimePresence class
Enables the presence set to be entered and subscribed to, and the historic presence set to be retrieved for a channel.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- syncComplete ↔ bool?
-
Whether the presence set synchronization between Ably and the
clients on the channel has been completed. Set to
true
when the sync is complete.getter/setter pair
Methods
-
enter(
[Object? data]) → Future< void> -
Enters the presence set for the channel, optionally passing a
data
payload associated with the presence member. A clientId is required to be present on a channel. -
enterClient(
String clientId, [Object? data]) → Future< void> -
Enters the presence set of the channel for a given
clientId
, which is the ID of the client to enter into the presence set. You can also pass adata
payload associated with the presence member. -
get(
[RealtimePresenceParams? params]) → Future< List< PresenceMessage> > -
Retrieves the current members present on the channel and the metadata for
each member, such as their PresenceAction and ID, based on provided
params
. Returns an array of PresenceMessage objects. -
history(
[RealtimeHistoryParams? params]) → Future< PaginatedResult< PresenceMessage> > -
Retrieves a
PaginatedResult
object, containing an array of historical PresenceMessage objects for the channel, based on providedparams
. -
leave(
[Object? data]) → Future< void> - Leaves the presence set for the channel. A client must have previously entered the presence set before they can leave it.
-
leaveClient(
String clientId, [Object? data]) → Future< void> -
Leaves the presence set of the channel for a given
clientId
, which is the ID of the client to leave the presence set for. You can also provide adata
payload, associated with the presence member. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
subscribe(
{PresenceAction? action, List< PresenceAction> ? actions}) → Stream<PresenceMessage> -
Returns a stream that emmits a
PresenceMessage
each time a matchingaction
, or an action within an array ofactions
, is received on the channel, such as a new member entering the presence set. -
toString(
) → String -
A string representation of this object.
inherited
-
update(
[Object? data]) → Future< void> -
Updates the data payload for a presence member. If called before entering
the presence set, this is treated as a PresenceAction.enter event.
You can provide the
data
payload to update for the presence member. -
updateClient(
String clientId, [Object? data]) → Future< void> -
Updates the
data
payload for a presence member using a givenclientId
, which is the ID of a client to update in the presence set.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited