RelaySyncManager constructor

RelaySyncManager({
  1. required CRDTDocument document,
  2. required RelaySocketClient client,
})

Manager for a relay client.

It is responsible for:

  • enqueueing local document changes and pushing them to the relay with at-least-once delivery (RelayPendingQueue)
  • importing the room state served by the relay (welcome) and the rebroadcast changes of other clients
  • answering compaction requests with a snapshot upload that never covers log entries this client has not imported (RelaySeqTracker)

Constructor

Implementation

RelaySyncManager({
  required this.document,
  required this.client,
})  : _queue = RelayPendingQueue(),
      _seqTracker = RelaySeqTracker() {
  // Listen to the local changes and enqueue them for the relay
  _localChangesSubscription = document.localChanges.listen(enqueue);
}