stop method

Future<void> stop()

Implementation

Future<void> stop() async {
  await _subscription?.cancel();
  _subscription = null;
  _heartbeat?.cancel();
  _heartbeat = null;

  for (final client in _clients.toList()) {
    try {
      await client.close();
    } catch (_) {}
  }
  _clients.clear();
  _clientWatch.clear();

  await _server?.close(force: true);
  _server = null;
}