newSubscription method
void
newSubscription({})
Implementation
void newSubscription({
required void Function(Event) onEvent,
required void Function() onClose,
required String channel,
String? lastEventId,
}) {
_logFine("New subscriber on channel $channel.");
ProxySink<Event> sub = new ProxySink(onAdd: onEvent, onClose: onClose);
_subsByChannel.putIfAbsent(channel, () => []).add(sub);
if (_cache != null && lastEventId != null) {
scheduleMicrotask(() {
_logFine("Replaying events on channel $channel from id $lastEventId.");
_cache!.replay(sub, lastEventId, channel);
});
}
}