stop method

  1. @override
Future<void> stop()

Stops the transport, closing all active connections.

Implementation

@override
Future<void> stop() async {
  if (!_started) return;
  _started = false;

  _discoveryTimer?.cancel();
  _discoveryTimer = null;

  for (final conn in _connections.values) {
    await conn.close();
  }
  _connections.clear();
  _dialing.clear();
  _reconnectAttempts.clear();

  await _mdnsServer?.stop();
  _mdnsServer = null;
  await _wsServer?.close(force: true);
  _wsServer = null;

  await _events.close();
  await _inbound.close();
}