MQTT

1 light weighted traffic , usually used for IoT Gateway and Borker. 

 

The MQTT protocol is based on the principle of publishing messages and subscribing to topics, or "pub/sub". Multiple clients connect to a broker and subscribe to topics that they are interested in. Clients also connect to the broker and publish messages to topics. Many clients may subscribe to the same topics and do with the information as they please. The broker and MQTT act as a simple, common interface for everything to connect to. This means that you if you have clients that dump subscribed messages to a database, to Twitter, Cosm or even a simple text file, then it becomes very simple to add new sensors or other data input to a database, Twitter or so on.

 

  • Publish example:

sensors/COMPUTER_NAME/temperature/HARDDRIVE_NAME

  • Subscribe example:

sensors/+/temperature/+

 

  • QOS

 

 

  • 0: The broker/client will deliver the message once, with no confirmation.

  • 1: The broker/client will deliver the message at least once, with confirmation required.

  • 2: The broker/client will deliver the message exactly once by using a four step handshake.

 

posted @ 2020-05-01 04:59  anyu686  阅读(131)  评论(0编辑  收藏  举报