Skip to content

Commit df60404

Browse files
committed
umqtt.simple: Add standalone pub example.
1 parent f44a33c commit df60404

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

umqtt.simple/example_pub.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from umqtt.simple import MQTTClient
2+
3+
# Test reception e.g. with:
4+
# mosquitto_sub -t foo_topic
5+
6+
def main(server="localhost"):
7+
c = MQTTClient("umqtt_client", server)
8+
c.connect()
9+
c.publish(b"foo_topic", b"hello")
10+
c.disconnect()
11+
12+
if __name__ == "__main__":
13+
main()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy