WebSocketSyncProvider class
A WebSocket-based SyncProvider that also receives server-pushed changes.
The push side is fire-and-forget — the server pushes changes, the client applies them. The push side does NOT use the syncAsync / pull API; the pull API is still there for the initial sync and for back-fills.
- Implemented types
Constructors
-
WebSocketSyncProvider({required Uri url, required ServerPushHandler pushHandler, Future<
String?> auth()?, Future<Object> channel(Uri)?}) - Creates a WebSocketSyncProvider.
Properties
-
connected
→ Stream<
bool> -
A broadcast stream of connection state
changes. New subscribers receive the
current state as the first event
(replay-1).
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isConnected → bool
-
trueif the WebSocket is currently connected.no setter - pushHandler → ServerPushHandler
-
Handler for server-pushed changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- url → Uri
-
The WebSocket URL.
final
Methods
-
close(
) → Future< void> - Closes the WebSocket connection.
-
connect(
) → Future< void> - Opens the WebSocket connection. Safe to call multiple times — subsequent calls are no-ops.
-
currentWatermarkAsync(
) → Future< int> -
Returns the current server-side watermark
(e.g. the latest
versionof any change). The user can use this to bootstrap the local watermark.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
syncAsync(
SyncEnvelope envelope) → Future< SyncEnvelope> -
Receives the local
envelopeand returns the remote envelope (the changes that have happened on the server sinceenvelope.since).override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited