close method

Future<void> close()

Closes the channel and stops reconnect attempts. Safe to call multiple times.

Implementation

Future<void> close() async {
  if (_closed) return;
  _closed = true;
  _reconnectTimer?.cancel();
  await _sub?.cancel();
  await _channel?.sink.close();
  await _controller.close();
}