Created
November 12, 2019 02:29
-
-
Save jyotendra/2b3b0a993f2f4b60e97eb6026004f54d to your computer and use it in GitHub Desktop.
This gist demonstrates a simple-publisher and a simple-subscriber
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
import paho.mqtt.publish as publish | |
publish.single("bv_solutions/test", "payload", hostname="mqtt.eclipse.org") |
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
import paho.mqtt.subscribe as subscribe | |
topics = ['bv_solutions/test'] | |
m = subscribe.simple(topics, hostname="mqtt.eclipse.org", retained=False, msg_count=1) | |
if m is not list: | |
m = [m] | |
for a in m: | |
print(a.topic) | |
print(a.payload) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment