stop method

Future<void> stop()

Implementation

Future<void> stop() async {
  if (_stopped) return;
  _stopped = true;
  _likeTimer?.cancel();
  _likeTimer = null;
  _wake?.complete();
  _wake = null;
  _failPendingAcks();
  connected.value = false;
  final ws = _ws;
  _ws = null;
  try {
    await ws?.close(1000, 'leave');
  } catch (_) {}
}