The MQTT protocol
Before going further, we will go into a bit more detail about the MQTT protocol that we are going to use in this project. You can find all the details about this protocol at the following link:
The MQTT protocol was created as a lightweight messaging protocol for the Internet of Things. It is now used in many IoT projects as well as machine-to-machine (M2M) applications.
It works on the publish/subscribe principle. An MQTT device can subscribe to a given channel; this device will then receive all the messages posted on this channel. This is what we are going to use to receive orders from the Web to control the relay.
On the other hand, an MQTT device can also publish messages to a given channel. This is what we are going to use to send sensor measurements and monitor them from the Web.