RelaySocketClient class abstract

Interface for a relay client.

A relay client syncs a CRDTDocument through a relay server that never interprets CRDT data: the relay persists and rebroadcasts opaque change blobs, and merging happens entirely on the clients.

Deviations from the CRDTSocketClient contract:

  • CRDTSocketClient.sendChange enqueues the change and delivers it at-least-once: the change leaves the queue only when the relay acknowledges it. Local document changes are enqueued automatically.
  • CRDTSocketClient.requestSync asks the relay for the persisted room state, which is merged into the document (merge: true).
  • CRDTSocketClient.sessionId is assigned by the relay on join and is null while disconnected.
Inheritance
Implementers

Constructors

RelaySocketClient({List<ClientSyncPlugin>? plugins})
Constructor

Properties

author → PeerId
The peer ID
no setterinherited
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
no setterinherited
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 setter
messages Stream<Message>
Stream of incoming server messages
no setterinherited
pendingChangesCount int
Number of local changes not yet acknowledged by the relay.
no setter
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 setterinherited
statedCapabilities SyncCapabilities?
capabilities as the peer states them, or null when they claim nothing.
no setterinherited

Methods

closeClientStreams() → void
Ends faults and connectionStatus. Call it from dispose.
inherited
connect() Future<bool>
Connect the client to the server
inherited
disconnect() Future<void>
Disconnect the client from the server
inherited
dispose() → void
Dispose the client
inherited
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
inherited
sendChange(Change change) Future<void>
Send a Change to the server
inherited
sendMessage(Message message) Future<void>
Send a Message to the server
inherited
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