This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# vim: set fileencoding=utf8 : | |
import mosquitto | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf8') | |
def on_message(mosq, obj, msg): | |
print(msg.topic + " : " + msg.payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import mosquitto | |
import time | |
pub_sent = False | |
def pub_on_connect(mosq, obj, rc): | |
mosq.publish("/A/B", "message one", 2, True) | |
mosq.publish("/A/B", "message two", 2, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import mosquitto | |
import textwrap | |
def on_message(mosq, obj, msg): | |
for s in textwrap.wrap(msg.payload, width=32): | |
print(s) | |
mqttc = mosquitto.Mosquitto() |
NewerOlder