disconnect method
Implementation
Future<void> disconnect() async {
if (_state is Disconnected) {
return;
}
_shouldReconnect = false;
_reconnectTimer?.cancel();
_reconnectTimer = null;
_keepAlive?.stop();
_updateState(const Disconnected());
await _channel?.sink.close();
_channel = null;
}