We are working on a satellite-linked IoT project where every byte of data is extremely expensive. We’ve been using MQTT, but the keep-alive overhead is eating our budget. Would switching to CoAP provide significant savings, or is the complexity of UDP-based reliability not worth the effort compared to standard TCP/MQTT?
3 answers
For satellite links, CoAP is often superior because it is built on UDP, eliminating the heavy three-way handshake and persistent connection overhead of TCP. CoAP’s header is only 4 bytes, whereas MQTT has a much larger footprint when you factor in the TCP overhead and the frequent "Keep-Alive" packets required to maintain the broker connection. However, remember that because UDP is connectionless, you must handle message deduplication and reliability at the application layer. If your satellite provider charges per packet, the lack of a persistent session in CoAP can save you thousands of dollars in the long run.
Have you looked into MQTT-SN (Sensor Networks)? It’s specifically designed to bring the benefits of MQTT to UDP-based networks without the heavy TCP baggage.
If bandwidth cost is your primary driver, CoAP is the winner. Just make sure your security layer (DTLS) doesn't add back all the bytes you just saved.
Spot on, Joseph. Security overhead is the 'hidden cost' of IoT protocols that many people forget to calculate until they see the first bill.
We looked at MQTT-SN, Paul, but our gateway provider doesn't natively support the bridge yet. We are leaning towards CoAP because it allows us to use a RESTful architecture which our web developers find easier to integrate. The main challenge now is ensuring we don't lose data during satellite handovers. We are implementing a 'Confirmable Message' logic in CoAP to mimic the QoS 1 level we liked in MQTT, which seems to be a good middle ground for our specific cost constraints.