This example code does the following:
- Set up a WiFi connection on the ESP32-C3
- Spawn a thread using std::thread in which we listen for incoming MQTT events.
- In the newly spawned thread, handle MQTT events and look specifically for a Received event using match, then print the contents as a string in the console.
- Back in our main thread, subscribe to a topic and create an infinite loop in which we continuously publish to an MQTT topic, with pauses of 1 second in between.