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
capabilities → DocumentCapabilities
What this build tells the server it can read.
no setterinherited
connectionStatus Stream<ConnectionStatus>
Stream of connection status changes between client and server.
no setterinherited
connectionStatusValue ConnectionStatus
The current connection status. ConnectionStatus.disconnected until the first move.
no setterinherited
document → CRDTDocument
The local CRDT document
final
faults Stream<SyncFault>
What the client could not do with something the server sent.
no setterinherited
handshake → HandshakeGate
The handshake of the current connection attempt.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
incompatibility SyncIncompatibility?
Why the server refused this build, or null while it has not.
no setterinherited
isUnsupported bool
Whether the server has refused this build.
no setterinherited
lastFault SyncFault?
The last fault, or null while there has been none.
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 changes 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
statedCapabilities SyncCapabilities?
capabilities as the peer states them, or null when they claim nothing.
no setterinherited
url String
WebSocket relay server URL
final

Methods

closeClientStreams() → void
Ends faults and connectionStatus. Call it from dispose.
inherited
connect() Future<bool>
Connect to the relay
override
disconnect() Future<void>
Disconnect the client from the server
override
dispose() → void
Dispose the client
override
handleErrorMessage(ErrorMessage message) → void
Acts on an ErrorMessage the peer sent, for the codes every client answers the same way.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refuseBuild({required String code, required String reason}) → void
The server refused this build: stop for good.
inherited
refuseServerProtocolMismatch(int serverVersion) bool
Refuses a server that speaks another Protocol.protocolVersion, and says whether it did.
inherited
reportSyncFault(SyncFault fault) → void
Reports fault on faults and latches it on lastFault.
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
updateConnectionStatus(ConnectionStatus status) → void
Moves the client to status, and publishes it when it is a move.
inherited

Operators

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