close method

Future<void> close()

Terminates all active connections. If a client remains unclosed, the Dart process may not terminate.

Implementation

Future<void> close() async {
  if (_nameAcquiredSubscription != null) {
    await _nameAcquiredSubscription?.cancel();
  }
  if (_nameLostSubscription != null) {
    await _nameLostSubscription?.cancel();
  }
  if (_nameOwnerSubscription != null) {
    await _nameOwnerSubscription?.cancel();
  }
  if (_socket != null) {
    await _socket?.close();
  }
}