Package com.hivemq.client.mqtt.lifecycle
Interface MqttClientDisconnectedListener
- All Known Subinterfaces:
MqttClientAutoReconnect
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Listener which is notified when a client is disconnected (with or without a Disconnect message) or the connection
fails.
- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescriptionvoidListener method which is notified in the following cases: A client was disconnected (with or without a Disconnect message, by the server, client or user) or the connection failed.
-
Method Details
-
onDisconnected
Listener method which is notified in the following cases:- A client was disconnected (with or without a Disconnect message, by the server, client or user) or the
connection failed. The client state will still be
CONNECTEDand theMqttClientConnectionConfigwill still be present. - A connect attempt by the user failed. The client state will still be
CONNECTING. - A reconnect attempt by the client failed. The client state will still be
CONNECTING_RECONNECT.
MqttClientDisconnectedListenersare called toDISCONNECTEDorDISCONNECTED_RECONNECTif the client is instructed to reconnect.
This method must not block. If you want to reconnect you have to use the supplied
MqttClientDisconnectedContext.getReconnector().- Parameters:
context- provides context about the client that is now disconnected, the cause for disconnection and allows reconnecting.
- A client was disconnected (with or without a Disconnect message, by the server, client or user) or the
connection failed. The client state will still be
-