码迷,mamicode.com
首页 > 其他好文 > 详细

MQTT

时间:2020-02-04 10:54:21      阅读:85      评论:0      收藏:0      [点我收藏+]

标签:qos   UNC   iat   href   can   eve   als   The   call   

MQTT[1]消息队列遥测传输(Message Queuing Telemetry Transport)

subscribe to a topic and publish messages on that topic. 

The core of the client library is the client class which provides all of the functions to publish messages and subscribe to topics.

Main Client Methods

The paho mqtt client class has several methods.The main ones are:

  • connect() and disconnect()
  • subscribe() and unsubscribe()
  • publish()

Each of these methods is associated with a callback. 

1. create a client instance

client = paho.mqtt.client(client_name)

2. connect to a broker or server

Before you can publish messages or subscribe to topics you need to establish a connection to a broker.

client.conect(host_name)

3. subscribe to a topic

4. publish messages

publish(topic, payload=None, qos=0, retain=False)

 

MQTT meeting:

1. ask for the host address, port, so that you can connect to their broker/server. 

2. what should I subscribe to?

 

 

 

https://www.zhihu.com/question/19801131

 

MQTT

标签:qos   UNC   iat   href   can   eve   als   The   call   

原文地址:https://www.cnblogs.com/dulun/p/12258275.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!