# Internet of Things and Its Applications: A Comprehensive Survey
## 3 Background
These messages are essential for ensuring a connection between devices. The Constrained Application Protocol (CoAP) and Message Queue Telemetry Transport (MQTT) are the most used messaging protocols; however, some other famous protocols, including the Extensible Messaging and Presence Protocol (XMPP) and Advanced Message Queuing Protocol (AMQP), result in an efficient overall network performance [63]. The application of these four protocols is as follows and is simplified in Table 1 below:  
* **CoAP:** This is used in an IoT communication load susceptible to performance deprivation that occurs from traffic congestion. It is a web transfer protocol mainly developed for limited devices with a restricted processing memory and power, usually operating in low bit rate environments [64]. This Hypertext Transfer Protocol (HTTP) is similar to a web transfer protocol that is capable of extending the Representational State Transfer (RST) architecture to Low-Power Wireless Personal Area Networks (LoWPANs) [65]. Furthermore, the Low-Power Wide-Area Network (LoRaWAN) protocol provides the Medium Access Control (MAC) mechanism, which helps to enable communication between various devices and network gateways [66]. This protocol is based on a star topology and has several advantages in IoT applications, such as its low cost, low power, secure nature, and ease of deployment [67]. It follows the RST architecture and comprises a 4-byte header-only, including the User Datagram Protocol (UDP), as a default fundamental transport protocol. Moreover, it provides reliability through the retransmission timeout mechanism [68]. As CoAP works on top of UDP, it presumes possible end-to-end trustworthiness and primary control of congestion. This protocol operates in the application layer and is in charge of formatting the data formatting handshaking connection [69]. To communicate data, CoAP provides four types of messages, including the Confirmable message, the Non-Confirmable message,  
Figure 2: Internet of Things (IoT) architecture. the Acknowledgement message, and the Reset message. All in all, CoAP operates following a request/response approach [70];
* **MQTT**: This is used for lightweight M2M communications. It acts as an asynchronous protocol that follows the publish/subscribe protocol. The main goal of this protocol is to connect implanted devices and networks to middleware and applications. The advantages of MQTT are its ability to ensure routing in small cases, the fact that it is economical, its low memory, and its low power devices for susceptible and low bandwidth networks [71]. This protocol is extremely lightweight, which makes it suitable for M2M, WSN, and IoT [72]. It allows the transfer of telemetry-style data from devices to the server as messages, along with high latency or constrained networks [73];
* **XMPP**: This is mostly used for message exchange. It follows the publish/subscribe approach, which is more appropriate for IoT, contrary to the architecture of the CoAP request/response. Moreover, it represents an early protocol endorsed across the internet, regardless of relatively newer protocols, i.e., MQTT [74]. It is based on the Instant Messaging/Presence Protocol (IETF standards) that is used for multi-party chatting, voice and video calling, and telepresence [75]. The main benefits of XMPP consist of it being a secure protocol and the fact that it permits the addition of new applications on top of the core protocols [76];
* **AMQP:** This was developed for the financial industry. It is characterized by its capability in orientating messages, queuing, switching, security, reliability, and privacy [77]. Similar to XMPP, the AMQP protocol follows the same architecture of the publish/subscribe approach. The principal benefit of using AMQP consists of the store-and-forward element that guarantees reliability and trustworthiness, although it can involve possible network disruptions [78].