MQTT Auto Reconnect to Broker

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am working on an application based on the "WINC1500 MQTT Chat Example for SAMD21".   This uses the third party "paho mqtt" library.

 

http://asf.atmel.com/docs/3.40.0...

 

If, for whatever reason, the broker goes offline, I need to be able to automatically reconnect.  The issue I am having is that there seems to be no way for me to detect that the broker is offline.  No state change is triggered in the mqtt_Callback, My mqtt_publish() calls continue to return SUCCESS codes, and the "isConnected" flag in the mqtt struct continues to be TRUE.  But when the broker comes back online, it does not receive my published messages.

 

Does anyone have any experience implementing connection persistence with the MQTT library? 

 

 

 

 

Thanks

Last Edited: Fri. Mar 8, 2019 - 11:43 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

https://www.hivemq.com/blog/mqtt...

 

There is no such thing as "auto reconnect". Your MQTT client code needs to handle this.