internalDisconnect method
- @protected
Internal disconnect This is always passed to the connection handler to allow the client to close itself down correctly on disconnect.
Implementation
@protected
void internalDisconnect() {
// if we don't have a connection Handler we are already disconnected.
final connectionHandler = this.connectionHandler;
if (connectionHandler == null) {
MqttLogger.log(
'MqttClient::internalDisconnect - not invoking disconnect, no connection handler');
return;
}
if (autoReconnect && connectionHandler.initialConnectionComplete) {
if (!connectionHandler.autoReconnectInProgress) {
// Fire an automatic auto reconnect request
clientEventBus!.fire(AutoReconnect(userRequested: false));
} else {
MqttLogger.log(
'MqttClient::internalDisconnect - not invoking auto connect, already in progress');
}
} else {
// Unsolicited disconnect only if we are connected initially
if (connectionHandler.initialConnectionComplete) {
_disconnect(unsolicited: true);
}
}
}