Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions micropython/umqtt.simple/example_pub_tls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from umqtt.simple import MQTTClient

# Test reception e.g. with:
# mosquitto_sub -t foo_topic


def main(server="localhost"):
# NOTE: Checking server certificate is DISABLE
ssl_params = {"server_hostname": server}
c = MQTTClient(
"umqtt_client",
server=server,
port=8883,
user="<username>",
password="<password>",
keepalive=60,
ssl=True,
ssl_params=ssl_params,
)
c.connect()
c.publish(b"foo_topic", b"hello")
c.disconnect()


if __name__ == "__main__":
main()
Loading