I'm testing with the public MQTT broker at mosquitto.org which supports SSL. What changes do I need to make this test script use SSL? How do I then invoke mosquitto_sub? I've downloaded the certificate files mosquitto.org.der and mosquitto.org.pem - but how do I use them?
Code: Select all
from umqtt.simple import MQTTClient
from utime import sleep
server='test.mosquitto.org'
c = MQTTClient('umqtt_client', server, ssl = False, ssl_params = {})
c.connect()
try:
while True:
c.publish(b'foo_topic', b'hello')
print('Publish')
sleep(10)
finally:
c.disconnect()
Code: Select all
mosquitto_sub -h test.mosquitto.org -t foo_topic