disconnect method

Future<void> disconnect()

Disconnects from the WebSocket server

Implementation

Future<void> disconnect() async {
  _reconnectTimer?.cancel();
  _subscription?.cancel();
  await _channel?.sink.close();
  _channel = null;
  _isConnected = false;
  _connectionController.add(false);
}