close method

  1. @override
void close({
  1. Iterable<String?> channels = const [""],
})
override

Close the specified channels. All the connections with the subscribers to this channels will be closed. By default only closes the default channel.

Implementation

@override
void close({Iterable<String?> channels: const [""]}) {
  for (String? channel in channels) {
    List? subs = _subsByChannel[channel];
    if (subs == null) {
      continue;
    }
    _logInfo("Closing channel $channel with ${subs.length} subscribers.");
    for (var sub in subs) {
      sub.close();
    }
  }
  if (_cache != null) {
    _cache!.clear(channels);
  }
}