updatesFor method

  1. @override
Stream<void> updatesFor(
  1. ChatId id
)
override

Listens to the updates of DirectLinks for the provided ChatId while the returned Stream is listened to.

Implementation

@override
Stream<void> updatesFor(ChatId id) {
  final controller = _updates[id] ??= StreamController.broadcast(
    onListen: () async {
      Log.debug('updates($id) -> onListen()', '$runtimeType');
      await _initRemoteSubscription(chatId: id);
    },
    onCancel: () {
      Log.debug('updates($id) -> onCancel()', '$runtimeType');
      _subscriptions.remove(id)?.close(immediate: true);
    },
  );

  return controller.stream;
}