## Materials and Methods
### MQTT Protocol  
Message Queuing Telemetry Transport (MQTT) is an application layer protocol adopted for different applications such as monitoring data [22], user energy management [23], notification systems [24], handling mobility [25], heart and electrocardiogram monitoring [26; 27], it was adopted in the past by large-scale companies like Facebook in the messenger application [28].  
It is a client-server publish/subscribe messaging transport protocol. It is a lightweight, open, simple design to be easily implemented. These characteristics allow it to be used in constrained environments such as communication in the machine to machine (M2M) with IoT contexts where a small code footprint is required even if network bandwidth is at a premium [29].  
Building an IoT system requires IoT data transmission using IoT communication middleware. A topic is identified by a unique string. That string represents the hierarchy of topics themselves. This is similar to how folders are identified on a computer. All information is organized on different topics. Each client connected to the broker could be either an information subscriber or publisher. As the protocol exchanges data through topics while all devices with the same topic are connected to the broker hence, its location is important for MQTT broker-based IoT middleware [30].  
Every time a publisher (mist node) will post a new message on a topic (sensor data), the MQTT broker (EMQ) forwards that message to all subscribed clients (MongoDB) to that topic. In this way, publishers and subscribers could send or receive data ignoring the existence with the locations of other clients. Another important MQTT feature is the possibility of setting different Quality of Services (QoS) in client connection to the broker. A different level of QoS determines a different security level regarding the delivery of the message to the destination [31; 32].  
MQTT protocol has been chosen from HTTP even though they have a considerably smaller footprint. MQTT protocol is suitable for resource-constrained environments. All MQTT-based brokers have similar or comparable abilities. The Mosquito broker by default does not provide security for its messaging scheme. Here authentication information is sent in plaintext therefore, it requires security mechanisms to protect the transferred information [33].  
In this context, from the available MQTT brokers explored, the two open sources (Mosquito, and Erlang MQTT) had been explored, the latter is chosen. EMQ broker provides a scalable, reliable, enterprise-grade PUB/SUB MQTT message Hub for IoT. It is written in Erlang/OTP under Apache Version 2.0 that is cross-platform, which was deployed on different operating systems and even Raspberry Pi [34]. EMQ implements both MQTT V3.1 and V3.1.1 protocol specifications and supports MQTT-SN, CoAP, WebSocket, STOMP, and SockJS at the same time [35].  
In the framework displayed in Figure 4, the environmental parameters are acquired from a room, including the room name, floor number, and the geo-location of the building. This data is sent to the EMQ broker followed by the MQTT client subscriber as shown in Figure 4.