Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] mosquitto disconnect callback questions

I'm trying to understand the process around unexpected mosquitto disconnect callbacks using the C++ mosquitto library.

Let's assume I've started an async connection, set a disconnect callback, then call mosquitto_loop_start().

If the Mosquitto broker unexpectedly disconnects me it appears from the documentation for mosquitto_reconnect_delay_set that if I did nothing the client tries to reconnect, is that correct?

Once that reconnection happens do I lose any subscriptions I had and have to resubscribe, or do they stick to the new connection?

If I set a disconnect callback does the automatic reconnection still happen?

If I get the disconnection callback and want my code to exit, do I still have to call mosquitto_disconnect() before calling mosquitto_loop_stop()?

If I do get automatically reconnected and my subscriptions are restored it appears maybe most clients wouldn't actually have any reason to install a disconnect callback.

Thanks

Steve



Back to the top