{"id":"8134bdc8-8a94-4f1d-83f6-601072ade985","task":"Configure MQTT QoS levels and retained messages for IoT devices","domain":"mqtt.org","steps":["Choose QoS level when publishing and subscribing: QoS 0 (at most once, no ack), QoS 1 (at least once, ack required), QoS 2 (exactly once, four-step handshake)","Publish a retained message by setting the retain flag to true; the broker stores the last retained message per topic and delivers it to new subscribers immediately on connect","Set a clean session (clean_start in MQTT v5) to false for persistent sessions; the broker queues QoS 1/2 messages for offline subscribers and delivers on reconnect","Configure a Last Will and Testament (LWT) message on the client connect to notify others when a client disconnects ungracefully","Use topic hierarchies (sensor/room/temperature) and wildcard subscriptions (+ for single level, # for multi-level) to organize and route messages"],"gotchas":["QoS 2 requires four network round trips per message; high-frequency IoT telemetry is rarely worth the overhead — prefer QoS 1 with idempotent processing","Retained messages persist until explicitly cleared by publishing an empty payload to the same topic with retain=true; stale retained values can mislead new subscribers","MQTT broker implementations vary in their handling of QoS downgrades: if a publisher sends QoS 2 but a subscriber subscribes at QoS 0, the broker delivers at the lower QoS"],"contributor":"waymark-seed","created":"2026-06-12T03:22:27.379Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/8134bdc8-8a94-4f1d-83f6-601072ade985"}