disconnect method

Future<void> disconnect([
  1. int? code,
  2. String? reason
])

Closes the WebSocket connection

Implementation

Future<void> disconnect([int? code, String? reason]) async {
  _log('Disconnecting WebSocket');
  _heartbeatManager.stop();
  _reconnectionManager.stopReconnection();
  await _adapter.disconnect(code, reason);
}