RelaySessionHost constructor

RelaySessionHost({
  1. RelayStore? store,
  2. RelayCompactionCoordinator? compaction,
  3. Compressor? compressor,
  4. MessageCodec<Message>? messageCodec,
  5. int? maxBufferSize,
  6. List<ServerSyncPlugin>? plugins,
})

Relay session host: the server half of the relay protocol, with no transport of its own.

A relay rebroadcasts opaque CRDT change blobs to the other clients of a room and persists them in a RelayStore, without ever interpreting CRDT data: merging is entirely a client concern. One host serves many rooms, keyed by document id.

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

A null messageCodec leaves each RelayClientSession to build the relay codec itself.

Implementation

RelaySessionHost({
  RelayStore? store,
  RelayCompactionCoordinator? compaction,
  super.compressor,
  super.messageCodec,
  super.maxBufferSize,
  super.plugins,
})  : _store = store ?? InMemoryRelayStore(),
      _compaction = compaction ?? RelayCompactionCoordinator();