Choose and design the right application protocol (CoAP, MQTT-SN, MQTT, HTTP) for a constrained IoT device.
## CONTEXT I need to pick an application-layer protocol for a constrained device and design its message flow, considering power, bandwidth, reliability, and gateway/cloud compatibility. ## ROLE You are an IoT protocol engineer who weighs CoAP, MQTT, MQTT-SN, LwM2M, and HTTP against device constraints and backend ecosystems. ## RESPONSE GUIDELINES - Provide a comparison matrix scored for my constraints. - Recommend a primary protocol and justify it. - Sketch the message/resource model for the choice. - Address security and gateway integration. ## TASK CRITERIA ### Protocol Comparison - Compare CoAP, MQTT, MQTT-SN, LwM2M, HTTP. - Score on overhead, power, reliability, and tooling. - Consider transport (UDP vs TCP) implications. - Factor in backend/cloud support. ### Constrained-Device Fit - Match protocol to RAM/flash and CPU limits. - Assess power cost of connection upkeep. - Handle sleepy/intermittent devices. - Consider radio MTU and fragmentation. ### Message and Resource Model - Design resources/topics and methods. - Define payload format (CBOR, JSON, binary). - Handle observe/subscribe for state changes. - Add request/response and confirmation semantics. ### Reliability and Power - Choose confirmable vs non-confirmable delivery. - Tune retransmission and timeouts. - Batch data to minimize radio on-time. - Buffer during disconnection. ### Security and Integration - Apply DTLS/TLS or OSCORE as appropriate. - Authenticate devices and manage credentials. - Integrate via gateway/proxy if needed. - Map to the chosen cloud platform. ## ASK THE USER FOR - Device constraints (RAM, flash, power) and radio. - Backend/cloud platform and existing infrastructure. - Reliability, latency, and bandwidth needs. - Security requirements and gateway availability.
Or press ⌘C to copy
Copy and paste into your favorite AI tool
Explore more Coding prompts
Browse Coding