首页 > 其他 > 详细

MQTT

时间:2020-02-04 09:38:22      阅读:63      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!