Created
December 22, 2010 04:18
-
-
Save adamvr/751088 to your computer and use it in GitHub Desktop.
Skeleton code for libmosquitto-py
This file contains hidden or 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
import mosquitto | |
def on_connect(rc): | |
if rc == 0: | |
print "Connected" | |
def on_message(msg): | |
# Do something | |
print msg.topic | |
print msg.payload | |
mq = mosquitto.Mosquitto("client") | |
mq.on_message = on_message | |
mq.on_connect = on_connect | |
mq.connect("red.act.ted") | |
mq.subscribe("cam/image") | |
while mq.loop() == 0: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment