Open
Description
I git clone paho.mqtt.cpp v1.2.0, build example and run async_subscibe, everything is ok
$ git status
HEAD detached at v1.2.0
$ ./src/samples/async_subscribe
\Connecting to the MQTT server...
Connection success
Subscribing to topic 'hello'
for client paho_cpp_async_subcribe using QoS1
Press Q<Enter> to quit
Subscription success for token: [1]
token topic: 'hello', ...
And then I test the reconnect function
systemctl restart mosquitto.service
the error happened:
Connection lost
Reconnecting...
Connection attempt failed
Error: MQTT error [-18]: Connect or disconnect command ignored
Isn't it better to report errors through on_failure here?
At present, when I introduce the reconnection function, I must use try catch to catch the exception.
So, is there a better solution?
Similar problems also occur in the async client publish interface:
paho_mqtt::message_ptr message = paho_mqtt::make_message(topic, data, size);
client_->publish(message, /*user context*/nullptr, *iaction_cb_);
it will throw exception when client is disconneted
Metadata
Metadata
Assignees
Labels
No labels