# A Reliable Publish-Subscribe Mechanism for Internet of Things-Enabled Smart Greenhouses
## 3 Research Methodology
### Proposed Anatomy of SGP MQTT Topic  
The categorization of topics has significant importance within the MQTT protocol due to its ability to provide streamlined and proficient communication, systematic data organization, enhanced security measures, and insightful analytics. Figure 4 illustrates the anatomical structure of both conventional MQTT packets and the proposed SGP packets. In traditional MQTT communication (Section A of Figure 4), the inclusion of MQTT topics in every message sent introduces additional overhead to each communication. The potential impact of this overhead in systems with huge volumes might be substantial, resulting in heightened bandwidth consumption and diminished performance. The management of subscriptions to topics by MQTT brokers is a kind of overhead. When a customer opts to subscribe to a substantial quantity of subjects, the broker may experience a notable consumption of resources, resulting in a decline in performance. The repetition of levels occurs in each data packet sent at a frequency of one per second, as determined by thefarmer's selection, either from the client to the broker or in the other direction. These data packets consist of many subject levels, which are delimited by a forward slash (/). As seen in Figure 4, the components involved in this scenario include an actuator, temperature, and humidity sensors, a digital output, and an analog input. It is noteworthy to acknowledge that within each transmission, certain topic levels undergo value changes while others remain consistent. However, due to the nature of sending the entire data packet, topic levels that remain unchanged are still transmitted, resulting in an augmentation of the number of bytes and data volume. Consequently, this leads to a decrease in the performance of the MQTT protocol. According to [39], the citation is as follows: as seen in Figure 4, it is evident that there are some limitations. Specifically, only three parameters undergo modifications, while two parameters, namely, temperature and digital output, remain constant. However, by the conventional broker structure, these two fixed values are redundantly sent to the server on each occasion. Our proposed framework (Section B of Figure 4) integrates a unique topic for each data point and its corresponding value, encapsulating them as individual packets inside the MQTT broker. One benefit of this system is its ability to selectively transmit only relevant data to the server, namely, events and parameter changes occurring inside the greenhouse. This approach effectively reduces the transmission of extraneous information to the server. The example shown in section B of Figure 4 demonstrates the modification and transmission of three parameters, namely, actuator, humidity, and analog input, to the server. This is achieved without the need to transmit two fixed values. In addition, it is possible to minimize the quantity of messages and the volume of data sent to a client in the form of a packet, resulting in a more scalable and efficient system when compared to section A. Consequently, the total data volume is reduced from 200 bytes to 60 bytes. In essence, the proposed topic standardization feature enables clients to use filters to sort communications according to certain themes, hence reducing the influx of extraneous information. Consequently, this approach effectively mitigates data redundancy. The appropriate categorization of topics facilitates the systematic arrangement of data, hence enhancing its manageability and maintenance. Additionally, it aids in the process of searching for and retrieving certain information. The critical factor is in the comprehensive evaluation of the advantages, whereby our suggested anatomical structure ultimately results in a decrease in latency for message transmission, hence requiring a reduced amount of traffic. Figure 4: A comparison of two greenhouse data transmission payload frameworks; Section A: Traditional MQTT communication. Section B: Proposed MQTT communication.