In an IoT project, the vision is to create a network consisting of several thousand devices that collect and send data using capabilities such as the internet. Connectivity is enabled using cellular technologies such as 2G/3G/4G/5G or a gateway that enables connectivity to the internet. A local network that connects through a gateway is enabled using technologies such as ZigBee, Wi-Fi and Bluetooth, among others. Whichever technology is used to enable connectivity, the objective is to transmit the data using internet. The data is then stored in the cloud or in a customized server that can be accessed through the internet. The focus of this article is to discuss the protocols that enable gateway, internet and application communication.
In an IoT project, there are three communication challenges faced and they are listed below:
• Communication between devices on a local network.
• Communication between devices through the internet and communication between devices and servers that store data.
• Communication between servers that store data.
Application layer protocols founded on TCP and UDP solve the communication challenges faced in an IoT project. The TCP protocol enables the XMPP, MQTT and REST/HTTP communication protocols. The UDP protocol enables DDSI and there are DDSI implementations on TCP/IP.
Device and data storage server communication is enabled by XMPP and MQTT protocols that are enabled by TCP/IP. The RESTful API supported by HTTP enables client/server communication. In subsequent sections, the communication protocols will be discussed in detail.
The message queue telemetry transport (MQTT): – is a machine to machine architecture developed to enable lightweight connectivity. MQTT supports publish/subscribe over TCP. TCP minimizes the risk of data loss and brings in stream simplicity and reliability. The publish/service protocol is advantageous in an IoT environment because there is no requirement on clients to request updates which minimizes bandwidth, battery and computational requirements. Due to the advantages identified MQTT is suitable for home automation and mobile communication. MQTT is laid out in a star architecture where all devices connect to a common server. The server is referred to as a broker and TCP enables communication between a server and a client. Security is enforced through a user name and a password in a similar way to HTTPS.
MQTT offers flexibility in quality by allowing three levels of quality enforcement which are listed below: –
• The first option is sending a message without an acknowledgment requirement
• The second option is sending a message once and requiring an acknowledgment
• The third option is requiring only one delivery through a handshake mechanism
The constrained application protocol (CoAP): – uses request/response to enable communication in recourse-constrained environments. Because the design of CoAP is a subset of HTTP interoperability between CoAP and HTTP is possible. CoAP is implemented over UDP to minimize its footprint. UDP is preferable over TCP because UDP minimizes bandwidth and overhead as compared to TCP. Because of the unreliability of UDP the design of CoAP included reliability. Every packet has a header that specifies message type and quality level required. The message types that can be specified are listed below.
• A confirmable message type is sent synchronously or asynchronously and an acknowledgment is required.
• A non-confirmable message does not require acknowledgment.
• An acknowledgment message type requires confirmation of a processed message.
• In a reset message type confirmation of a message that has not been processed is needed.
CoAP lacks security and the solution to this limitation is the datagram transport layer security (DTLS) which is the equivalent of TLS securing TCP. DTLS has limitations that reduce its suitability in an IoT environment. DTLS lacks support for multicast which is a key advantage of CoAP relative to other protocols. DTLS handshakes place a heavy burden on network and device battery which reduces usefulness of battery powered devices that are central to success of IoT.
Another application layer protocol is extensible messaging and presence protocol (XMPP). The protocol was designed to facilitate chat and messaging. Although XMPP is not suitable in other areas IoT is one area that would benefit from XMPP. Asynchronous and synchronous publish/subscribe over TCP. It is the publish/subscribe approach that makes XMPP better that CoAP in IoT applications. The disadvantage of XMPP is use of XML which increases computational and power use because of XML parsing. XMPP is excellent in supporting near real time because of low latency and small footprint in messaging.
Representational state transfer (REST): – enables synchronous request/response over HTTP. Caching and authentication among other HTTP features can be used in REST. The accept HTTP header specifies the data format as XML or JSON. REST can be implemented in machine to machine, smartphone and tablet environments which have made it important in IoT. The disadvantage of REST is difficulty in implementation.
The advanced message queuing protocol (AMQP): – enables asynchronous publish/subscribe approach to communication over TCP but other transport protocols can be used. Reliability is flexible with three delivery levels which are listed below.
• A message is sent only once when a delivery or failure happens.
• There is a guarantee of one or more message delivery.
• There is a guarantee a message will only be delivered once.
Security in AMQQ is implemented using TLS/SSL over TCP.
When selecting the application layer protocol to use in an IoT, the following factors need to be considered:
• Bandwidth requirement
• Data latency
• Memory and code footprint
In this article, the importance of connectivity in an IoT project. We identified the communication challenges faced in an IoT project and their solutions. We discussed various application layer protocols used in an IoT project, their advantages and disadvantages.