I have a MQTT Client (lets call it Client-1) using java PAHO, this is pub and sub to topics without problem, on the other side of the globe I have another client (lets call it SuperClient) that can public topics as commands for my Clients...
one of those commands is "DISCONNECT-NOW", in my Client-1 I have implemented the callback where I recieve correctly that msg, however, when I try to disconnect according to that command I get an Exception:
ReasonCode: 32107
Message: Disconnecting using a Callback-method is not allowed
LocalizedMsg: Disconnecting using a Callback-method is not allowed
Exception: Disconnecting using a Callback-method is not allowed (32107)
Disconnecting using a Callback-method is not allowed (32107)
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31) at org.eclipse.paho.client.mqttv3.internal.ClientComms.disconnect(ClientComms.java:460) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:632) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:601) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:608) at org.eclipse.paho.client.mqttv3.MqttClient.disconnect(MqttClient.java:256) at co.ve.de.MqttBroker.disconnect(MqttBroker.java:94) at co.ve.de.Implementation.lambda$1(Implementation.java:53) at co.ve.de.MqttBroker$1.messageArrived(MqttBroker.java:132) at org.eclipse.paho.client.mqttv3.internal.CommsCallback.deliverMessage(CommsCallback.java:475) at org.eclipse.paho.client.mqttv3.internal.CommsCallback.handleMessage(CommsCallback.java:379) at org.eclipse.paho.client.mqttv3.internal.CommsCallback.run(CommsCallback.java:183) at java.lang.Thread.run(Unknown Source)
my question: is there any way to disconnect asynchronously from the network without doing some weird long polling ??
Thanks!