Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Confirmation about how QoS works

Woo it works :) I had to turn off 'clear state' too though in mosquitto_new.

I had one of my MQTT client's connection's die while publishing, after re-connecting it re-published fine.


On Sun, Jul 15, 2018 at 9:43 AM, chris <anfractuosity@xxxxxxxxxxxxxxxxx> wrote:

I'm just wondering if anyone can confirm with my following code, using a QoS of 2, at the client. That if the connection goes down, and it re-connects, that if a message failed to be published during that time, that it will automatically attempt to be re-sent, because it is using a QoS of 2?

        rc = mosquitto_connect(mosq, mqtt_host, mqtt_port, 60);

        while (run) {
            rc = mosquitto_loop(mosq, -1, 1);
            if (rc != 0) {
            } else {
                end_t = time(0);
                // publish sensor message each hour
                if (end_t - start_t > 3600) {
                    mosquitto_publish(mosq, NULL, "test/topic",size,sbuf, 2, 0);

Back to the top