Closed alexander-ryker closed 1 year ago
Update: We were able to work around this by placing our will_set() call in the on_disconnect() callback. I will leave it to the Eclipse team to decide if this issue should be kept or closed.
I have added an on_pre_connect()
callback which should solve this problem for you. It will be part of the next feature release.
After calling loop_start(), the MQTT client module will handle the necessary networking and reconnect logic in its own thread. To my knowledge, however, once loop_forever() is running in its own thread (as a result of the loop_start() call) there is no way to call will_set() with a new Node death payload before the client module calls connect() as needed.
Could a callback be added as an optional argument to loop_start() that would allow custom logic to be executed immediately prior to the connect() call?