ClientAwarenessPlugin constructor

ClientAwarenessPlugin({
  1. MessageCodec<Message>? codec,
  2. Map<String, dynamic>? initialMetadata,
  3. Duration throttleDuration = const Duration(milliseconds: 50),
})

Constructor

initialMetadata is the initial metadata of the client sent to the server onConnected

codec is the codec to use to encode and decode the messages. default to JsonMessageCodec

throttleDuration is the duration to wait before sending the awareness update to the server. default to 50 milliseconds

Implementation

ClientAwarenessPlugin({
  MessageCodec<Message>? codec,
  Map<String, dynamic>? initialMetadata,
  Duration throttleDuration = const Duration(milliseconds: 50),
})  : messageCodec = codec ??
          JsonMessageCodec<Message>(
            toJson: (message) => message.toJson(),
            fromJson: AwarenessMessage.fromJson,
          ),
      _initialMetadata = initialMetadata,
      _awarenessController = StreamController<DocumentAwareness>.broadcast(),
      _throttler = Throttler(throttleDuration);