RealtimeChannel class

A subscription to a Realtime topic, created with RealtimeClient.channel.

Register listeners with onPostgresChanges, onBroadcast, and the presence on* members, then call subscribe to join the topic on the server.

Constructors

RealtimeChannel(String topic, RealtimeClient socket, {RealtimeChannelConfig config = const RealtimeChannelConfig()})
Creates a channel for topic on socket.

Properties

hashCode → int
The hash code for this object.
no setterinherited
onPresenceJoin → Stream<RealtimePresenceJoinPayload>
Emits whenever clients join the presence state of the channel.
no setter
onPresenceLeave → Stream<RealtimePresenceLeavePayload>
Emits whenever clients leave the presence state of the channel.
no setter
onPresenceSync → Stream<RealtimePresenceSyncPayload>
Emits whenever the presence state of the channel is synced.
no setter
onStatusChange → Stream<RealtimeSubscribeStatusChange>
Emits every status change of this channel's subscription, along with the error that caused it for RealtimeSubscribeStatus.channelError.
no setter
onSystemEvents → Stream<RealtimeSystemPayload>
Emits realtime system events.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

httpSend({required String event, required Object payload, Duration? timeout}) → Future<void>
Sends a broadcast message explicitly via REST API.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onBroadcast({required String event}) → Stream<Map<String, dynamic>>
Sets up a listener for realtime broadcast messages.
onPostgresChanges({required PostgresChangeEvent event, String? schema, String? table, PostgresChangeFilter? filter, List<PostgresChangeFilter>? filters, List<String>? select}) → Stream<PostgresChangePayload>
Sets up a listener on your Supabase database.
presenceState() → List<SinglePresenceState>
The current presence state, keyed by presence key.
sendBroadcastMessage({required String event, required Map<String, dynamic> payload}) → Future<ChannelResponse>
Sends a realtime broadcast message over the WebSocket.
subscribe([Duration? timeout]) → RealtimeChannel
Subscribes to receive real-time changes
toString() → String
A string representation of this object.
inherited
track(Map<String, dynamic> payload, [Map<String, dynamic> options = const {}]) → Future<ChannelResponse>
Shares payload with every other client tracking presence on this channel.
unsubscribe([Duration? timeout]) → Future<String>
Leaves the channel
untrack([Map<String, dynamic> options = const {}]) → Future<ChannelResponse>
Stops sharing this client's presence on this channel.

Operators

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