Interface MqttConnectionObserver


@NonNullByDefault public interface MqttConnectionObserver
Implement this interface to get notified of connection state changes. Register this observer at .
Author:
Markus Rathgeb - Initial contribution, David Graeff - Rewritten
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Inform the observer if a connection could be established or if a connection is lost.
  • Method Details

    • connectionStateChanged

      void connectionStateChanged(MqttConnectionState state, @Nullable Throwable error)
      Inform the observer if a connection could be established or if a connection is lost. This will be issued in the context of the Mqtt client thread and requires that the control is returned quickly to not stall the Mqtt thread.
      Parameters:
      state - The new connection state
      error - An exception object (might be a MqttException) with the reason why a connection failed.