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
publish
request if Mqtt hasn’t yet published successfully, or it is retrying due to slow internet. How to cancel apublish
request? - How to set timeout for
publish
request? So that I know that afterTHIS
many seconds Mqtt will not try topublish
again.
Read more here: Source link