espressif / esp-rainmaker

ESP RainMaker Agent for firmware development
Apache License 2.0
453 stars 152 forks source link

How to check if device is connected to server (MEGH-3684) #145

Closed SubhodipRoy161101 closed 2 years ago

SubhodipRoy161101 commented 2 years ago

I would like to know which function would tell us if the device is connected to the cloud or not. It would simply check if esp32 is connected to the cloud and return true if it is connected and return false if it is not connected.

shahpiyushv commented 2 years ago

@SubhodipRoy161101 , there is no API that gives this information directly, but your application code can use the RMAKER_MQTT_EVENT_CONNECTED and RMAKER_MQTT_EVENT_DISCONNECTED events to track the connectivity as you can see here.