paho.mqtt.android
paho.mqtt.android copied to clipboard
Automatic Reconnect Support now??
what can i do in public void connectionLost(Throwable cause) { } method, if it lost connect?
I'm not 100% sure what you're question is, but if you're asking what the purpose of connectionLost is.. You can use connectionLost to notify your main application / user that the connection has been lost, this might be useful if you want to have different behaviour when there is no connection. Though if you are using Offline buffering, then you could continue to publish messages as normal.
haha~thank you so much for your reply, thank you help me add the question label also.
I just don't know what can i do in this method@Override public void connectionLost(Threwable cause){// how to reconnect} after the connection losted.
Assuming that you have enabled the automatic reconnect functionality in the MqttConnectOptions:
MqttConnectOptions mqttConnectOptions = new MqttConnectOptions();
mqttConnectOptions.setAutomaticReconnect(true);
Then you don't have to do anything, the client will attempt to reconnect for you, the connectionLost callback is just there so that you can notify the application / user that the connection was lost, you could just leave it empty if you wanted to.
Seems setAutomaticReconnect(true) doesn't work well based on latest commit. I encountered the problem when there was wifi connection lost and recovery, there was no successful connection anymore. Is there any update for this issue now? Thanks.
@eclipsewebmaster Any update since Nov 16, 2017?
@eclipsewebmaster Any update?
+1
+1
setAutomaticReconnect(true) doesn't work
Any plans on fixing a bug 4 Year old bug? :grin: