Docs

Dart: Realtime

Join channels, send and receive messages, follow connection status and catch up after a reconnect with the Dart and Flutter SDK.

Updated Oct 24, 2026

Join channels, send and receive messages, follow connection status and catch up after a reconnect. Every call runs as the client's signed-in user, so your project's policies and row-level security apply. Types and members are listed in source order; each one links to its HTTP endpoint where it maps to one.

#Types and members

WebSocketConnector

Opens a WebSocket (swap it in tests).

typedef WebSocketConnector

RealtimeStatus

enum RealtimeStatus

Values: connecting, live, reconnecting, closed.

SovariaRealtime

Realtime channels: final ch = sovaria.realtime.channel('room:42'); ch.messages.listen(...). Each connection uses a one-time ticket (the token never goes in the URL); the channel reconnects with backoff and stops when the user is signed out or not allowed.

class SovariaRealtime

SovariaRealtime.SovariaRealtime

Create an instance.

SovariaRealtime(this._client, {WebSocketConnector? connector})
    : _connector

SovariaRealtime.channel

catchUp: after a reconnect, deliver the messages published while the socket was down (from the channel's replay history) — in order, once each — before new ones.

RealtimeChannel channel(String name, {Duration maxBackoff = const Duration(seconds: 15), bool catchUp = true})

SovariaRealtime.publish

Publish to a channel over HTTP (no socket needed).

Future<void> publish(String channel, Map<String, Object?> payload)

SovariaRealtime.replay

Messages after after (by stream_seq), oldest first: {events: [...]}.

Future<dynamic> replay(String channel, {int after = 0, int limit = 200})

SovariaRealtime.presence

Who is in a channel right now.

Future<dynamic> presence(String channel)

SovariaRealtime.closeAll

Future<void> closeAll()

RealtimeChannel

class RealtimeChannel

RealtimeChannel.name

A property.

final String name

RealtimeChannel.status

A property.

RealtimeStatus status

RealtimeChannel.messages

Message payloads (frame.payload, pings filtered out).

Stream<Map<String, Object?>> get messages

RealtimeChannel.statusChanges

A property.

Stream<RealtimeStatus> get statusChanges

RealtimeChannel.errors

A property.

Stream<Object> get errors

RealtimeChannel.gaps

Messages that were missed and can't be recovered (older than the channel's retained history, or the history couldn't be read).

Stream<RealtimeGap> get gaps

Reload your state from the source of truth when one arrives.

RealtimeChannel.send

Publish a message to everyone on the channel.

Future<void> send(Map<String, Object?> payload)

RealtimeChannel.close

Future<void> close()

RealtimeGap

Messages fromSeq..toSeq (by stream_seq) were missed and can't be recovered; toSeq is null when the history couldn't be read. reason: not_retained or replay_failed.

class RealtimeGap

RealtimeGap.RealtimeGap

Create an instance.

const RealtimeGap(this.fromSeq, this.toSeq, this.reason)

RealtimeGap.fromSeq

A property.

final int fromSeq

RealtimeGap.toSeq

A property.

final int? toSeq

RealtimeGap.reason

A property.

final String reason

RealtimeGap.toString

String toString()