kopia lustrzana https://github.com/micropython/micropython-lib
Merge a68e8b30ff
into 6e24cffe95
commit
ebcc849077
|
@ -0,0 +1,23 @@
|
||||||
|
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()
|
Ładowanie…
Reference in New Issue