Mqtt paho 回调函数触发机制跟踪
Python Mqtt paho 回调函数触发机制跟踪,我使用的是 buildroot 里面的 mqtt paho , 代码在
‘’‘
buildroot-2017.02.8/output/build/python-paho-mqtt-1.2/src/paho/mqtt
‘’‘python mqtt 的使用方法如下:
‘’‘
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
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)
‘’’
它主要是使用回调函数的方法,让我很好奇,所有有这篇记录

更多精彩