In 2023, Statista estimated that 15.14 billion Internet of Things (IoT) devices existed worldwide, to become 29.4 billion in 2030 [1]. These IoT devices find applications across many domains, performing a range of critical tasks such as patient monitoring, forest fire control, and search and rescue missions. As they have become prevalent in our daily lives, there is a growing demand for developers to create and implement software systems for these IoT devices. These IoT applications run on devices or cloud servers communicating via different protocols. The two prominent protocols for IoT communication are the Constrained Application Protocol (CoAP) [2] and Message Queuing Telemetry Transport (MQTT) [3], which are designed for IoT devices with limited capabilities [4], such as limited battery and processing resources.

CoAP and MQTT are two standards, RFC7252 [2] and ISO/IEC 20922 [5], that have been implemented by different organisations in different programming languages, both as closed and open source. For example, the Eclipse Foundation [6] provides Californium and Paho MQTT open-source libraries in Java of CoAP and MQTT, respectively. The IBM Watson IoT Platform Message Gateway[7] provides an implementation of MQTT.

By Mar. 1st, 2023, there were 35 reported libraries of CoAP [8] and 40 of MQTT [9], with different characteristics, like levels of completeness and runtime performances. We studied and finally selected the four libraries: Californium [11], java-coap [12], HiveMQ MQTT Client [13], Paho MQTT [14].

We Collected, devised, and implemented scenarios using the chosen libraries. We Collected static metrics (LOC, CBO, CC, LCOM) on the implemented senders and receivers. We analysed packet sizes theoretically and practically. In addition, we collected runtime performances (goodput, throughput, overhead) when running the scenarios.

Finally, HiveMQ MQTT Client performs well in our static metrics. In addition, we found that in our experiment, java-coap uses the least packet size, but the Californium library is actively maintained, we concluded that the libraries of CoAP in our experiment use less packet size, and run faster. But we recommend HiveMQ MQTT Client for the ease of its usage.

References:

[1] Statista. Number of Internet of Things (IoT) connected devices worldwide from 2019 to 2030(in billions), 2022. https://www.statista.com/statistics/1183457/io
t-connected-devices-worldwide/.

[2] Shelby, Zach and Hartke, Klaus and Bormann, Carsten. The constrained application protocol (CoAP), 2014. https://datatracker.ietf.org/doc/html/rfc7252.

[3] MQTT.org. MQTT: The Standard for IoT Messaging, 2022. https://mqtt.org/.

[4] Marwa O. Al Enany, Hany M. Harb, and Gamal A. Attiya. Comparative analysis of MQTT and IoT application protocols. International Conference on Electronic Engineering (ICEEM), pages 1–6, 2021. IEEE CS Press.

[5] https://www.iso.org/standard/69466.html, as of March 1st, 2023

[6] https://newsroom.eclipse.org/news/announcements/eclipse-iot-working-group-celebrates-its-10th-anniversary, as of March 1st, 2023

[7] https://www.ibm.com/docs/en/wip-mg/5.0.0.1, as of March 1st, 2023

[8] https://en.wikipedia.org/wiki/Constrained_Application_Protocol#Implementations, as of March 1st, 2023

[9] https://en.wikipedia.org/wiki/Comparison_of_MQTT_implementations, as of March 1st, 2023

[10] https://www.istockphoto.com/illustrations/iot-logo, as of March 1st, 2023

[11] https://github.com/eclipse-californium/californium, as of March 1st, 2023


[12] https://github.com/PelionIoT/java-coap, as of March 1st, 2023


[13] https://github.com/eclipse/paho.mqtt.java, as of March 1st, 2023


[14] https://github.com/hivemq/hivemq-mqtt-client, as of March 1st, 2023