B4R Question Connect to MQTT broker with TLS

Gerardo Tenreiro

Active Member
Licensed User
Hello,
I'm starting tests to use MQTT on the HIVEMQ server that has TLS enabled.
I use the EREL example, slightly modified, and I can't get the ESP32 to connect to the BROKER.
I attach a piece of code that I use and call after being connected to the WIFI network.
It always returns FALSE to the connection.

Any help or suggestions

As always, thank you very much and greetings to this great group

'
' Conecta MQTT al BROKER
Public Sub MQTT_Conecta(Nada As Byte)
Log("Intentando Conectar MQTT")

Dim mo As MqttConnectOptions '
mo.Initialize("TEST","1234") ' Usuario y Contraseña
If MQTT.Connect2(mo) = False Then ' Opciones de Conexion
CallSubPlus("MQTT_Conecta",10000,0) ' Si no se Conecto lo Vuelve a Intentar en 10"
Log("MQTT no Conecto Nombre ",mo.UserName," Pass ",mo.Password)
Return
End If

Log("MQTT Conectado al BROKER",True) ' Si se Conecta
MQTT.Subscribe("P_LL1", 0) ' Escucha Pulsador 1
MQTT.Subscribe("P_LL2", 0) ' Escucha Pulsador 2
MQTT.Subscribe("P_LL3", 0) ' Escucha Pulsador 3
MQTT.Subscribe("P_RESET", 0) ' Escucha Pulsador RESET
End Sub
 
Top