mqtt_message_receive error trying to connect to broker

AleGiaco
Posts: 10
Joined: Thu Feb 06, 2020 9:48 am

mqtt_message_receive error trying to connect to broker

Postby AleGiaco » Tue Apr 28, 2020 10:51 am

Hi,

I'm trying to connect to my broker with the esp32 mqtt ssl template but I get this errors:

I (7091) MQTT_CLIENT: Sending MQTT CONNECT message, type: 1, id: 0000
E (7131) MQTT_CLIENT: mqtt_message_receive: transport_read() error: errno=128
E (7131) MQTT_CLIENT: esp_mqtt_connect: mqtt_message_receive() returned -1
I (7131) MQTT_CLIENT: Error MQTT Connected
I (7141) MQTTS_EXAMPLE: MQTT_EVENT_DISCONNECTED

The configuration is classic:

Code: Select all

    const esp_mqtt_client_config_t mqtt_cfg = {
        .uri = CONFIG_BROKER_URI,
        .cert_pem =  (const char *)mqtt_eclipse_org_pem_start,
    };
with
CONFIG_BROKER_URI = mqtt://myBrokerUri:port
and
in mqtt_eclipse_org_pem_start I setted the route of my certificate via Broker certificate override: certs/myCert.pem

I tried to connect to hivemq.com and I had no difficulties so i think the problem is that eclipse doesn't see the certificate.

Someone can help me?

Regards

pollock694
Posts: 4
Joined: Tue May 26, 2020 8:27 am

Re: mqtt_message_receive error trying to connect to broker

Postby pollock694 » Tue Jul 07, 2020 12:15 pm

Could you try specifying these parameters too?

Code: Select all

         
         .port = MQTT_PORT,
	 .transport = MQTT_TRANSPORT_OVER_SSL,
         .cert_pem = (const char *)mqtt_eclipse_org_pem_start,
 	.username = MQTT_USER_NAME,
 	.password = MQTT_PASSWORD,
 	.client_id = MQTT_CLIENT_ID,
 	.keepalive = MQTT_KEEPALIVE
		

ESP-Marius
Posts: 74
Joined: Wed Oct 23, 2019 1:49 am

Re: mqtt_message_receive error trying to connect to broker

Postby ESP-Marius » Wed Jul 08, 2020 1:31 am

Your issue is probably that you are setting your uri to

Code: Select all

mqtt://
when it should be

Code: Select all

mqtts://
With mqtt:// you get a plain TCP connection without SSL, but you are probably connecting to a port/broker which expects SSL, so it rejects your connection.

Who is online

Users browsing this forum: No registered users and 120 guests