Integration notes
Use the steps below as a general guide for binding NanoMQTT to either clear-text TCP or TLS.
Switch transports in one line
/* TLS (port 8883, NanoSSL already negotiated) */ MQTT_setTransportSSL(conn, ssl); /* Plain TCP (port 1883) */ MQTT_setTransportTCP(conn, socketFd);
Note
Call one of the above before MQTT_negotiateConnection()
. The rest of the API is identical.
Build note
The socket helpers are always available. Enable the asynchronous wrapper only if you need it:
# static or CMake: add the macro -D__ENABLE_MQTT_ASYNC_CLIENT__ # helper script ./build_mqtt_client.sh --async
Quick validation
Pass 1 - TCP Bind with
MQTT_setTransportTCP
; connect to port 1883 and publish a test message.Pass 2 - TLS Switch to
MQTT_setTransportSSL
, port 8883, and supply--ssl_ca_file <bundle>
. The payload and topic should be identical.
A match between the two passes confirms both the NanoSSL handshake and the MQTT control flow.