-
Python Mqtt paho 回调函数触发机制跟踪,我使用的是 buildroot 里面的 mqtt paho , 代码在
‘’‘
buildroot-2017.02.8/output/build/python-paho-mqtt-1.2/src/paho/mqtt
‘’‘ -
python mqtt 的使用方法如下:
‘’‘
self.__mqtt_id = str(math.floor(time.time()))
self.mqtt = mqtt.Client(self.__mqtt_id)
self.mqtt.username_pw_set(self.config["mqtt"]["username"])
self.mqtt.on_connect = self.on_connect
self.mqtt.on_disconnect = self.on_disconnect
self.mqtt.on_message = self.on_messageself.__mqtt__.connect(self.config["mqtt"]["wss_addr"], self.config["mqtt"]["wss_port"], keepalive=10)
‘’’
-
它主要是使用回调函数的方法,让我很好奇,所有有这篇记录