Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] From application how to initiate reconnection of bridge on network change

Hello Mosquitto Team,


I am trying to create an application on Beaglebone using Mosquitto (1.4.2) which sends sensor data to cloud MQTT via local broker. Both local MQTT and cloud MQTT are connected via Bridge. Device which runs local MQTT uses WiFi interface to send traffic to ISP gateway and is forwarded to cloud. User via application can switch WiFi networks on the device. The application is subscribed to “$SYS/broker/connection/#” message from local broker about the bridge status.


Problem: Switching WiFi network on device breaks the bridge b/w local MQTT and cloud MQTT. It takes Local MQTT broker around 60 sec to realise network switch.


A quick look into code, it seems when physical connection got updated/modified, local MQTT uses the stale socket to connect to cloud and takes around 60 sec to timeout on not receiving PINGREQ response message from cloud MQTT.  


Is there any way for the application to ask local MQTT  to reinitiate bridge connection on switching of WiFi network instead of waiting for local MQTT to timeout and then to reinitiate by itself? I tried reloading the local MQTT by sending SIGHUP signal from application to initiate reconnection between local MQTT and cloud MQTT but it didn't work.


Please feel free to share any comments or in case further information is needed.




Back to the top