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 TypeMethodDescriptionvoid
connectionStateChanged
(MqttConnectionState state, @Nullable Throwable error) Inform the observer if a connection could be established or if a connection is lost.
-
Method Details
-
connectionStateChanged
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 stateerror
- An exception object (might be a MqttException) with the reason why a connection failed.
-