LiamBindle / MQTT-C

A portable MQTT C client for embedded systems and PCs alike.
https://liambindle.ca/MQTT-C
MIT License
775 stars 275 forks source link

Add 'connected_callback' that is invoked when CONNACK is received #178

Open MartinKlang opened 1 year ago

MartinKlang commented 1 year ago

CONNACK signals that the connection with the server has been established.

It is common to wait for CONNACK before sending e.g. subscribe requests. In some cases it is necessary, e.g. with Thingsboard (reference).

Sometimes a dialogue is required between client and broker at connection time, which may require calling mqtt_sync(). This can safely be done from the connected callback.