DocumentClientSession constructor

DocumentClientSession({
  1. required String id,
  2. required TransportConnection connection,
  3. required CRDTServerRegistry serverRegistry,
  4. Compressor? compressor,
  5. MessageCodec<Message>? messageCodec,
  6. int? maxBufferSize,
  7. List<ServerSyncPlugin> plugins = const [],
})

CRDT-aware client session on server.

Implements the document sync protocol on top of ClientSession: handshake with version vectors, applying incoming changes to the CRDTServerRegistry and answering document status requests.

Constructor

Implementation

DocumentClientSession({
  required super.id,
  required super.connection,
  required CRDTServerRegistry serverRegistry,
  super.compressor,
  MessageCodec<Message>? messageCodec,
  super.maxBufferSize,
  super.plugins,
})  : _serverRegistry = serverRegistry,
      super.base(
        messageCodec: messageCodec ??
            JsonMessageCodec<Message>(
              toJson: (message) => message.toJson(),
              fromJson: (json) =>
                  SyncMessage.fromJson(json) ?? Message.fromJson(json),
            ),
      );