endStatsSubscriptions method

void endStatsSubscriptions(
  1. String principalId, {
  2. String code = 'forbidden',
})

Ends the stats.live subscription of every connection of principalId with one error {op: stats.subscribe} with code, as the server does when stats.read is lost (25 5.1 item 3).

Implementation

void endStatsSubscriptions(String principalId, {String code = 'forbidden'}) {
  for (final c in _open) {
    if (c.principalId != principalId || c.session?.stats == null) continue;
    c.session!.stats = null;
    _send(c, 'error', {'op': 'stats.subscribe', 'code': code});
  }
}