timeout – In Android MQTT how to Cancel a Publish request
I am using this Mqtt library in Android:
api 'com.github.hannesa2:paho.mqtt.android:4.1'
I am able to publish requests like this:
import org.eclipse.paho.client.mqttv3.*
...
val message = MqttMessage()
message.payload = msg.toByteArray()
message.qos = qos
message.isRetained = retained
mqttClient?.publish(topic, message)
I have 2 questions regarding this:
- After certain user action, I want to cancel the
publishrequest if Mqtt hasn’t yet published successfully, or it is retrying due to slow internet. How to cancel apublishrequest? - How to set timeout for
publishrequest? So that I know that afterTHISmany seconds Mqtt will not try topublishagain.
Read more here: Source link
