The ConnectAndReconnect sub takes care of connecting to the broker and reconnecting if the connection has broken. It sends a "ping" request every 5 seconds to help the MQTT client recognize network failures. It is a nice example of how Wait For and Sleep can help to manage the network state...