DocumentSessionHost constructor

DocumentSessionHost({
  1. required CRDTServerRegistry serverRegistry,
  2. Compressor? compressor,
  3. MessageCodec<Message>? messageCodec,
  4. int? maxBufferSize,
  5. List<ServerSyncPlugin>? plugins,
})

CRDT-aware session host: the server half of the document sync protocol, with no transport of its own.

It keeps the CRDTServerRegistry, turns accepted connections into DocumentClientSessions, rebroadcasts applied changes, and takes an aligned snapshot once every subscribed client has confirmed the server's state.

Once running, it also sends each snapshot a document of the registry takes to the clients of that document.

Feed it connections with SessionHostServer.acceptConnection. For a host that owns its own dart:io socket, use WebSocketServer instead.

Implementation

DocumentSessionHost({
  required CRDTServerRegistry serverRegistry,
  super.compressor,
  super.messageCodec,
  super.maxBufferSize,
  super.plugins,
}) : _serverRegistry = serverRegistry;