Add example for mqtt tls

pull/458/head
Mr Keuz 2021-10-29 17:16:24 +03:00 zatwierdzone przez GitHub
rodzic 3c383f6d28
commit d035d9e2f7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 20 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,20 @@
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)
if __name__ == "__main__":
main()