crdt_socket_sync 0.6.0
crdt_socket_sync: ^0.6.0 copied to clipboard
Conflict-free replicated data type (CRDT) - Socket sync implementation provided in dart
0.6.0 #
Date: 2026-07-26
Breaking changes (Dart names only — not the protocol)
The CRDT-aware sync frames and session-event values now live under Sync*
types. These are pure source-level renames: update the identifiers, the
on-the-wire messages stay byte-identical (a 0.5.x and a 0.6.0 peer still talk to
each other).
Messages:
→Message.changeSyncMessage.change→Message.changesSyncMessage.changes→Message.documentStatusSyncMessage.documentStatus→Message.documentStatusRequestSyncMessage.documentStatusRequestMessage.fromJsonnow decodes only the shared frames (ping/pong/error); in a custom codec chain it:SyncMessage.fromJson(json) ?? Message.fromJson(json).
Session events:
→SessionEventType.handshakeCompletedSyncSessionEventType.handshakeCompleted→SessionEventType.documentStatusCreatedSyncSessionEventType.documentStatusCreated→SessionEventType.changeAppliedSyncSessionEventType.changeApplied→SessionEventType.clientOutOfSyncSyncSessionEventType.clientOutOfSync
Added #
- Relay mode — a second sync model where the server stays dumb: it only
stores change blobs opaquely and rebroadcasts them per room, never parsing
CRDT data, so all merging happens on the clients. This enables a
CRDT-agnostic backend (no
crdt_lfon the server, easy to port to other runtimes, including serverless). Adds therelay_client,web_socket_relay_client,relay_serverandweb_socket_relay_serverlibraries; see the README for the full picture. 100
Fixed #
- The client libraries now actually export
ClientSyncPluginandSocketClientProvider(the plugin barrel previously self-exported, forcingsrc/imports for custom client plugins).
0.5.0+2 #
Date: 2026-07-19
Documentation release: refreshes the CHANGELOG and docs published on pub.dev. No functional changes since 0.5.0.
0.5.0+1 #
Date: 2026-07-18
Documentation release: refreshes the CHANGELOG and docs published on pub.dev. No functional changes since 0.5.0.
0.5.0 #
Date: 2026-07-08
This release is a general pass to improve the sync process and clean up the
code following the improvements introduced in crdt_lf v3.0.0
(see #87).
Added #
- Client-side dead-connection detection: the client tracks pong replies and, if
no pong arrives within
Protocol.pingTimeout, treats the connection as dead and reconnects. Ping/pong durations are injectable via theWebSocketClientconstructors. - Backpressure: outbound sends are serialized through a bounded per-connection
queue. A peer that exceeds
Protocol.maxBufferSizeof un-flushed data is disconnected (and re-syncs on reconnect) instead of growing memory without bound. The bound is injectable on bothWebSocketClientandWebSocketServer. - Server auto-snapshot: clients report their version vector on pings, and the
server takes a snapshot and prunes confirmed history once every connected
client has confirmed a common frontier (
ServerEventType.snapshotCreated). PingMessagegained an optionalversionVectorfield. This is backward-compatible on the wire (older peers ignore the extra field).
Fixed #
WebSocketServer.stop()now actually closes every client session (previously a method tear-off meant sessions were never gracefully closed).- A broadcast no longer aborts when a single client's send fails: the failing client is dropped and the message still reaches every other subscribed client.
- Incoming client frames are decoded per-frame instead of through a shared buffer, so a single malformed/undecodable frame can no longer poison the decoding of every subsequent message.
- Text frames are decoded with UTF-8 on both client and server (previously the
client used
codeUnits, corrupting multi-byte payloads). InMemoryCRDTServerRegistry: The server's out-of-sync recovery path is no longer dead code:InMemoryCRDTServerRegistry.applyChangenow propagatesCausallyNotReadyExceptionso the server tells the client to re-sync instead of silently dropping the change.- The awareness client no longer clobbers its own just-updated presence when a full state message arrives from the server.
- The awareness throttler now fires the trailing action in a burst (the last cursor position is no longer dropped).
0.4.0 #
Date: 2026-06-11
Breaking changes
Wire protocol changed: Change, Snapshot, and VersionVector payloads are now transmitted as base64-encoded binary strings instead of JSON objects. Servers and clients running different versions are not compatible.
Affected message fields:
HandshakeRequestMessage.versionVector— wasMap<String, dynamic>, now a base64 string.HandshakeResponseMessage.versionVector,.snapshot,.changes[*]— same change.ChangeMessage.change— wasMap<String, dynamic>, now a base64 string.ChangesMessage.changes[*]— wasList<Map>, nowList<String>(base64).DocumentStatusMessage.versionVector,.snapshot,.changes[*]— same change.DocumentStatusRequestMessage.versionVector— same change.
Updated crdt_lf dependency to ^3.0.0.
Changed #
- All binary payloads in messages now use the compact binary format from
crdt_lf3.0.0 (Change.toBytes,VersionVector.toBytes,Snapshot.toBytes), reducing message size and eliminating JSON parsing overhead on the hot path. - chore: improved documentation adding design diagrams
- chore: update tests
0.3.0 #
Date:
Breaking changes
CRDTServerRegistry.addDocumenttakes adocumentIdandauthorparameterCRDTServerRegistrymethods now return aFuture- rename client
requestSnapshottorequestSync
Added #
- Feature: add
messageCodecparameter toWebSocketServerandWebSocketClient - Feature:
JsonMessageCodecnow supportstoEncodableandreviverparameters - Feature: added out of sync error handling
- Feature: added
messageBroadcastedandmessageSentserver events - Feature: added
ChangesMessage
Changes #
- Document status request can be sent without a version vector
- chore: added code coverage references
Fixed #
- Fixed sync problems during client disconnection
- Fixed transporter subscription on connection error
- Fixed double call on "onNewSession"
0.2.0 #
Date: 2025-06-26
Breaking changes
encodeanddecodemethods ofMessageCodechave nullable return type
Added #
- Feature: add plugin system
- Feature: add awareness plugin
Fixed #
- Fixed: Fix a missing status update during first connection
- Fixed: Fix a bug where the
connectstart a reconnection loop if the connection is lost
0.1.0+1 #
0.1.0 #
Date: 2025-06-14
Initial release