使用python、mosquitto(mqtt)库,mqtt重连命令的正确写法是什么?
我在下面累了,但这不起作用……我错过了什么吗?!
mqttc = mosquitto.Mosquitto()
mqttc.on_message = on_message
mqttc.on_connect = on_connect
mqttc.on_disconnect = on_disconnect
mqttc.on_publish = on_publish
mqttc.on_subscribe = on_subscribe
mqttc.reconnect_delay_set(120, 300, True)
mqttc.connect("test.mosquitto.org", 1883, 60)
mqttc.subscribe("/foo/bar", 0)