Interface MqttConnectionObserver


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

      • 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.