# E-MQTT: End-to-End Synchronous and Asynchronous Communication Mechanisms in MQTT Protocol
## 1 Introduction
This enhancement empowers publishers with the ability to check synchronously or asynchronously the moment when a message is delivered to subscribers. E-MQTT exhibits minimal divergence from the structure of MQTT packets, incorporating only a handful of additional fields. Despite being an extension of MQTT, E-MQTT still retains the intrinsic characteristics of the publish-subscribe model while augmenting it with the novel feature of the request-response model for end-to-end communication. The publisher can check when the subscriber has received the message without a separate additional process of subscribing to a new topic. To support the E-MQTT functionalities, we introduce a new QoS level 3 to MQTT. Although E-MQTT increases the QoS levels from MQTT, it does not imply that E-MQTT provides more reliable communication than MQTT. Instead, E-MQTT adds the functionality of request-response patterns to the publish-subscribe model for end-to-end communication between a publisher and subscribers. In the new feature of E-MQTT, the publisher specifies the minimum number of response packets that it wants to wait for. Should this count be set to 0, the publisher proceeds without waiting for a response, which is called asynchronous E-MQTT. In this scenario, the broker forwards the first response packet from a subscriber to the publisher, allowing the publisher to asynchronously check the moment of the response from one subscriber. Alternatively, if the minimum number of response packets is more than 0, the publisher can perform the next task only if it receives an aggregated response packet from the broker that has received the predetermined number of response packets from the subscribers. If the publisher receives an aggregated response packet, it knows that at least the predetermined number of subscribers have received its query message, and then continues to conduct the next task. This mode is referred to as synchronous E-MQTT. Additionally, the publisher has an option to specify particular subscribers to wait for, if it has knowledge of subscribers' identifiers (IDs). As E-MQTT reduces the required number of message exchanges compared to MQTT, experimental results show that E-MQTT consistently outperforms the conventional MQTT primarily in terms of the end-to-end delay when the publisher needs to check the status of subscribers. Instead, E-MQTT increases the size of some packets because it needs to include the additional information of the minimum number of response packets that the publisher wants to wait for. This minor modification causes a marginal increase in packet size compared to MQTT. The difference in packet size becomes notable only if the publisher adds numerous optional subscriber IDs. Despite this slight variation in packet size, the overall advantages offered by E-MQTT, especially in terms of improved delay performance, outweigh any negligible increase in packet size. In summary, the contributions of our research work are as follows:  
* Modified MQTT specifications (E-MQTT) to add the functionality of request-response patterns for end-to-end communication between a publisher and subscribers. * Enabled checking the moment when its message is received by subscribers. * Supported end-to-end communication in two modes according to the configuration of the minimum number of response packets: synchronous and asynchronous modes. * Implemented E-MQTT and compared performance with MQTT. * Reduced delay of end-to-end request-response communication. The remainder of this paper is organized as follows. In Section 2, we introduce related works about MQTT. In Section 3, we propose the synchronous and asynchronous end-to-end communication methods of E-MQTT. In Section 4, we describe the main classes, methods, and additional fields required for the implementation of E-MQTT. In Section 5, we analyze the performance of E-MQTT and compare it to the existing MQTT through the measurement of communication delay and message size. Finally, we conclude the paper with future research plans in Section 6.