RealtimeChannel class

Enables messages to be published and subscribed to.

Also enables historic messages to be retrieved and provides access to the RealtimePresence object of a channel.

Properties

errorReason ErrorInfo?
An ErrorInfo object describing the last error which occurred on the channel, if any.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
modes List<ChannelMode>?
An array of ChannelMode objects.
getter/setter pair
name String
The channel name.
no setter
params Map<String, String>?
Optional channel parameters that configure the behavior of the channel.
getter/setter pair
presence RealtimePresence
A RealtimePresence object.
no setter
push PushChannel
A PushChannel object.
getter/setter pair
realtime Realtime
A RealtimePresence object.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state ChannelState
The current ChannelState of the channel.
getter/setter pair

Methods

attach() Future<void>
Attach to this channel ensuring the channel is created in the Ably system and all messages published on the channel are received by any channel listeners registered using RealtimeChannel.subscribe.
detach() Future<void>
Detach from this channel. Any resulting channel state change is emitted to any listeners registered using the RealtimeChannel.on stream.
history([RealtimeHistoryParams? params]) Future<PaginatedResult<Message>>
Retrieves a PaginatedResult object, containing an array of historical Message objects for the channel using the specified params.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on([ChannelEvent? channelEvent]) Stream<ChannelStateChange>
Stream of channel events with specified ChannelEvent type
publish({Message? message, List<Message>? messages, String? name, Object? data}) Future<void>
Publishes a message or list of messages to the channel, or a single message with a given event name and data payload.
setOptions(RealtimeChannelOptions options) Future<void>
Sets the options for the channel.
subscribe({String? name, List<String>? names}) Stream<Message>
Registers a listener for messages on this channel for an event name or multiple event names.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited