closeChannel method

void closeChannel(
  1. DwLiveChannel channel, {
  2. int? accountId,
})

Closes channel for every subscribed connection, or only for those of accountId — what revoking access does.

Implementation

void closeChannel(DwLiveChannel channel, {int? accountId}) {
  for (final connection in openConnections.toList()) {
    if (accountId != null && connection.accountId != accountId) continue;
    if (!connection.subscriptions.remove(channel.wireName)) continue;
    connection.send(DwChannelClosedMessage(channel.wireName));
  }
}