[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [mosquitto-dev] Reconnection to a TLS server is unreliable.
|
This one I think I can actually help
with. Like you I previously thought I should catch the disconnect
callback and reconnect and found that to be unreliable.
I then discovered that by default
mosquitto will handle the reconnect part for you so there is no
need to do that. I also found out that once I did reconnect that
all my subscriptions were gone and needed to be recreated. The
better approach is to catch the connect callback and set up your
subscriptions there and let the default behavior handle the
reconnects. I have been stable ever since.
Steve Prior
On 4/8/2022 10:33 AM, Dougie Lawson
wrote:
Hi Roger,
I have a bit of code (that fetches my gas & electricity
meter data from
glowmqtt.energyhive.com). In the
last couple of weeks that server has been having connection
problems (which the owner tells me they've solved). But, I found
that this piece of code in my C program is unreliable.
It would frequently drive the disconnect callback with
RC=19 (MOSQ_ERR_KEEPALIVE) and fail to reconnect.
So last night I removed the mosquitto_loop_forever()
and replaced it with modq_start_loop() and turned all that
TLS stuff into a new function in my code.
I've run that for twelve hours now and haven't had a
failure during reconnection. I'm not sure whether
mosq_loop_forever() is handling the TLS stuff correctly
Is this an opportunity for you to improve how
mosq_loop_forever() handles a disconnection from a TLS
server? Or was my original code just a pile of junk?
Regards. Dougie
_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev