WebSocketRelayClient class

RelaySocketClient implementation using web socket.

Reconnects with exponential backoff plus jitter (RelayProtocol.reconnectBaseDelay, doubled per attempt up to RelayProtocol.reconnectMaxDelay) and, unlike WebSocketClient, retries forever by default (maxReconnectAttempts can bound it).

Inheritance

Constructors

WebSocketRelayClient({required String url, required CRDTDocument document, required PeerId author, Compressor? compressor, MessageCodec<Message>? messageCodec, Duration? pingInterval, Duration? pingTimeout, Duration? handshakeTimeout, int? maxBufferSize, int? maxReconnectAttempts, Duration? reconnectBaseDelay, Duration? reconnectMaxDelay, Duration? reconnectJitter, List<ClientSyncPlugin>? plugins})
RelaySocketClient implementation using web socket.
WebSocketRelayClient.test({required String url, required CRDTDocument document, required PeerId author, required Transport transportFactory(), Compressor? compressor, MessageCodec<Message>? messageCodec, Duration? pingInterval, Duration? pingTimeout, Duration? handshakeTimeout, int? maxBufferSize, int? maxReconnectAttempts, Duration? reconnectBaseDelay, Duration? reconnectMaxDelay, Duration? reconnectJitter, Random? random, List<ClientSyncPlugin>? plugins})
RelaySocketClient implementation using web socket.

Properties

author → PeerId
Author of the document
final
connectionStatus Stream<ConnectionStatus>
Stream of connection status changes between client and server
no setteroverride
connectionStatusValue ConnectionStatus
The current connection status
no setteroverride
document → CRDTDocument
The local CRDT document
final
hashCode int
The hash code for this object.
no setterinherited
lastKnownSeq int
The last relay log sequence number this client knows to have fully imported (0 before the first welcome).
no setteroverride
maxReconnectAttempts int?
Maximum reconnect attempts, null retries forever.
final
messages Stream<Message>
Stream of incoming server messages
no setteroverride
pendingChangesCount int
Number of local change blobs not yet acknowledged by the relay.
no setteroverride
plugins List<ClientSyncPlugin>
The client plugins
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sessionId String?
The session ID
no setteroverride
url String
WebSocket relay server URL
final

Methods

connect() Future<bool>
Connect to the relay
override
disconnect() Future<void>
Disconnect the client from the server
override
dispose() → void
Dispose the client
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestSync() Future<void>
Request a sync message from the server
override
sendChange(Change change) Future<void>
Enqueue change for the relay.
override
sendMessage(Message message, {bool attemptReconnect = true}) Future<void>
Send a message to the relay
override
toString() String
A string representation of this object.
inherited

Operators

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