Support for MQTT with TLS/SSL on ESP32 #9675
-
Hi everyone, I am trying to use MQTTs on ESP32. Since I am relatively new to TLS/SSL, I am very appreciative for any experience or suggestion from you! My ultimate goal is to connect my ESP32 to the MQTT broker of our enterprise As the first try, I have managed to connect to the public encrypted MQTT Broker client_id = "jdu-esp32-test"
client = MQTTClient(client_id, "test.mosquitto.org", 8883, user=None, password=None, keepalive=30, ssl=True, ssl_params={})
client.connect() However, with the same code (the only difference is that I must provide
I have tried several workarounds, but none of them solve my problem. I also find another discussion #9259. But when I try to use the solution provided by Carglglz https://github.com/orgs/micropython/discussions/9259#discussioncomment-3612105, I find that Version: MicroPython v1.19.1 on 2022-06-18; ESP32 module with ESP32 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found a same similar here https://stackoverflow.com/questions/68481716/micropython-https-request-blocks-further-requests. So the problem was, I am running out of RAM. When I only run a simple test script on my board, it works. I post my code below: user = b"........" # use binary is import! otherwise wont work
password_mqtt = b"........"
topic = ".../.../.../"
ssl_params = {}
client = MQTTClient(client_id,
host,
port,
user=user, password=password_mqtt,
keepalive=30, ssl=True, ssl_params=ssl_params)
client.connect()
while True:
client.publish(topic,
json.dumps({"temp": 10})
)
time.sleep(1) My experience is, the |
Beta Was this translation helpful? Give feedback.
I found a same similar here https://stackoverflow.com/questions/68481716/micropython-https-request-blocks-further-requests.
So the problem was, I am running out of RAM. When I only run a simple test script on my board, it works. I post my code below: