disconnect method

  1. @override
Future<void> disconnect()
override

Disconnect from the server

Implementation

@override
Future<void> disconnect() async {
  if (!connected) return;

  if (_channel != null) {
    await _channel!.sink.close(status.goingAway);
    _channel = null;
  }

  updateConnectionState(false);
}