Skip to main content

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

Hi,

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) {
                sleep(10);
                mosquitto_reconnect(mosq);
            } 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);
                    ......
                }
            }
        }
 
Thanks
Chris

Back to the top