getEventStreamForSubscription method

  1. @override
Stream<EventRecord> getEventStreamForSubscription(
  1. String subscriptionId
)
override

Gets the stream of events for a specific subscription.

Platform implementations can override this to route events per subscription. The default implementation falls back to the shared stream.

Implementation

@override
Stream<EventRecord> getEventStreamForSubscription(String subscriptionId) {
  return _subscriptionControllers
      .putIfAbsent(
        subscriptionId,
        () => StreamController<EventRecord>.broadcast(
          onCancel: _stopListeningIfIdle,
        ),
      )
      .stream;
}