You are reading a single comment by @lukevanhorn and its replies. Click here to read the full conversation.
  • It appears the MQTT client connection is rejected by the server. The TLS connection has been made, but hasn't finished authenticating yet (sd->connecting is still false, but the connected event is emitted). The mqtt connect should not be called until the TLS client authentication process is completed/authorized by the server.

    Here's the output without the delay and some notes:

    Connecting with TLS...
    Loading the CA root certificate...
    Loading certificate file: "certs/rootCA.pem"
    Loading the Client certificate...
    Loading certificate file: "certs/cert.pem"
    Loading the Client Key...
    Loading certificate file: "certs/key.pem"
    Performing the SSL/TLS handshake...
    TLS connected  ------------------->(logged in my TLS connected event handler)
    Client connected  ----------------->(logged in MQTT module connected event)
    Verifying peer X.509 certificate...   --->(logged ~line 530 of network.c)
    MQTT client disconnected   --------->(logged in MQTT end event)
    

    Maybe add an authorized event that fires after the authentication process? Or delay the connected event in this scenario?

About

Avatar for lukevanhorn @lukevanhorn started