IoT studying--MQTT protocol
Today we introduce a common protocol for Internet of Things.MQTT,The full name of the protocol is Message Queuing Telemetry Transport.It is designed for connections with remote locations where a"small code footprint"is required or the network bandwidth is limited.Before introducing MQTT,we talk about what is Protocol.In the digital wrold,the information is made up of 0 and 1.For a character like"a",how to use 0 and 1 to represent it? We need a definition，for example we use a string 0101010 to represent a. So this is a defined process,we define a sequence of 01 string to represent a character and we all recognize such a provision.Finally the communication between the computers will be unified.
Now we know what is Protocol,we can talk about what is MQTT.
MQTT is not a means of real-time communication.What is real-time communication?Like whatsapp，people send you a message and you will receive it immediately.But MQTT more like facebook,you follow one people and he update once per day.
Why MQTT is very suitable for the Internet of things?Let us cite another example,how to design a device in the room that it automatically control the air conditioning switch to adjust the temperature maintained at the most appropriate temperature in the human body?Firstly we need to transfer the data of the thermometer to the processing unit.And then it will adjust the air conditioning switch according to the level of temperature.For temperature, its change is a gradual process so we don't need a real-time data.We can get the temperature data from time to time.In this scenario we can use MQTT.When the time of the temperature acquisition unit is reached, or if other conditions are met, then the data is transferred to the processing unit.In many scenarios, they are very consistent, so MQTT becomes popular.
MQTT protocol implementation is complex,I use the following chart to help you better understand MQTT.Of course, if you want a deeper understanding MQTT, you still need to check the official website documents.
We still use the previous example.Now we have 3 clients.Client A is the provider of temperature,Client B is air conditioning,Client C is the display unit of temperature,Broker is the processing unit.
After Client A sends a temperature data,Broker will push temperature information to Client B and Client C under certain conditions.Then the two clients can get temperature information,thus adjusting the level of air conditioning and the temperature display unit displays the temperature.
Through these two pictures we can probably understand the work of MQTT.If you need a deeper understanding, you still need to check the official documents.