crdt_sync_server
library
Functions
-
listen(Crdt crdt, int port, {Duration? pingInterval = defaultPingInterval, ServerHandshakeDataBuilder? handshakeDataBuilder, ChangesetBuilder? changesetBuilder, RecordValidator? validateRecord, ChangesetMapper? mapIncomingChangeset, void onConnecting(HttpRequest request)?, ServerOnConnect? onConnect, OnDisconnect? onDisconnect, OnChangeset? onChangesetReceived, OnChangeset? onChangesetSent, void onUpgradeError(Object error, HttpRequest request)?, bool verbose = false})
→ Future<void>
-
Opens an HTTP socket and starts listening for incoming connections on the
specified
port
.
-
upgrade(Crdt crdt, HttpRequest request, {Duration? pingInterval = defaultPingInterval, ServerHandshakeDataBuilder? handshakeDataBuilder, ChangesetBuilder? changesetBuilder, RecordValidator? validateRecord, ChangesetMapper? mapIncomingChangeset, ServerOnConnect? onConnect, OnDisconnect? onDisconnect, OnChangeset? onChangesetReceived, OnChangeset? onChangesetSent, bool verbose = false})
→ Future<void>
-
Upgrades an incoming connection to a WebSocket and synchronizes the provided
crdt
.
Typedefs
-
ChangesetBuilder
= FutureOr<CrdtChangeset> Function({String? exceptNodeId, Hlc? modifiedAfter, Hlc? modifiedOn, String? onlyNodeId, Iterable<String>? onlyTables})
-
-
ChangesetMapper
= CrdtRecord Function(String table, CrdtRecord record)
-
-
ClientHandshakeDataBuilder
= FutureOr<Object>? Function()
-
-
OnChangeset
= void Function(String nodeId, Map<String, int> recordCounts)
-
-
OnConnect
= void Function(String peerId, Object? customData)
-
-
OnDisconnect
= void Function(String peerId, int? code, String? reason)
-
-
RecordValidator
= FutureOr<bool> Function(String table, CrdtRecord)
-
-
ServerHandshakeDataBuilder
= FutureOr<Object>? Function(String peerId, Object? peerData)
-
-
ServerOnConnect
= void Function(CrdtSync crdtSync, Object? customData)
-