Code QuizIntermediate Publishing device telemetry to a cloud IoT endpoint via MQTT
Spot the ordering mistake that stops telemetry from reaching the cloud MQTT broker.
Codepython
import paho.mqtt.client as mqtt
import json
client = mqtt.Client("sensor-01")
telemetry = {"tempC": 22.5, "humidity": 48}
# Send the reading to the cloud
client.publish("devices/sensor-01/telemetry", json.dumps(telemetry))
client.connect("mqtt.example-iot.com", 1883)
client.loop_forever()What is the bug in this code that prevents the telemetry from being delivered?