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 (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(MqttAutoReconnect(userRequested: false));
} else {
MqttLogger.log(
'MqttClient::internalDisconnect - not invoking auto connect, already in progress');
}
} else {
// Unsolicited disconnect
if (connectionHandler.initialConnectionComplete) {
_disconnect(unsolicited: true);
}
}
}