disconnect method

  1. @override
MqttConnectionState disconnect()
override

Disconnects

Implementation

@override
MqttConnectionState disconnect() {
  MqttLogger.log('MqttConnectionHandlerBase::disconnect');
  if (connectionStatus.state == MqttConnectionState.connected) {
    // Send a disconnect message to the broker
    sendMessage(MqttDisconnectMessage()
        .withReasonCode(MqttDisconnectReasonCode.normalDisconnection));
  }
  // Disconnect
  _performConnectionDisconnect();
  return connectionStatus.state;
}