AWS IoT control disconnect and reconnect

Hi All,

I have a project whereby I send data from an ESP32 to AWS IoT via MQTT and then subscribe to the Topic using the node-red-contrib-aws-iot-hub palette and log the data.

It works fine, and I am able to disconnect the MQTT connection from the ESP32 until I need to send data again, but I would like to know if there is a way to disconnect my node-red connection and reconnect when needed.

The idea will be that the ESP32 will send it's update frequency as a value in the Topic, and the node-red program will then disconnect for just less than this time period, and reconnect in time to receive the next updated Topic, and reduce overall connectivity time. I may only be taking readings once an hour.

Any ideas?

Many Thanks