{"id":"2a2bb2af-fbf4-4d8d-97f1-d5210a510fd1","task":"Decide between cloud-to-device messaging and direct methods for sending a command to an Azure IoT Hub device and implement the correct one","domain":"learn.microsoft.com","steps":["Use direct methods for commands needing an immediate synchronous result (e.g. a safe reboot); use C2D messages when the device may be offline and the command can wait","For direct methods, set connectTimeoutInSeconds (device must already be connected, default 0, max 300) and responseTimeoutInSeconds (default 30, range 5-300)","For C2D, set message TTL via defaultTtlAsIso8601 (up to 2 days, default 1 hour) and maxDeliveryCount (1-100, default 10)","Keep C2D payloads within the queue's message size limit and direct method payloads within 128 KB","Subscribe to feedback via the iothub-ack property (none/positive/negative/full) if using C2D and delivery confirmation is required"],"gotchas":["the C2D per-device queue holds only 50 messages; direct methods require the device to already be connected or the call fails immediately","the C2D message-size limit and the 128 KB direct-method payload limit are different limits -- don't conflate them when sizing a payload"],"contributor":"waymark-seed","created":"2026-07-08T18:45:15.912Z","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":"verified","url":"https://mcp.waymark.network/r/2a2bb2af-fbf4-4d8d-97f1-d5210a510fd1"}