disconnect method

Future<void> disconnect()

Disconnects from the WebSocket server.

Implementation

Future<void> disconnect() async {
  _isReconnecting = false;
  _reconnectionTimer?.cancel();
  _reconnectionStrategy.reset();
  _reconnectionAttempt = 0;

  await _connection?.disconnect();
  _connection = null;

  _eventController.add(WebSocketManagerEvent.disconnected());
}