Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last Will and Testament bug ? #13

Open
PeterScream opened this issue Jul 29, 2021 · 1 comment
Open

Last Will and Testament bug ? #13

PeterScream opened this issue Jul 29, 2021 · 1 comment

Comments

@PeterScream
Copy link

It seams that the last will msg never gets set after client disconnected
My settings are matching the example setup apart from BufferSize
(using 1020 - but had the same issue with standard default size)
authentication is in place (using username and pass no SSL)

Broker : aedes broker

Tested by seting enable to low , and stopped prog slot.
Have other clients that are connected to that broker and Last Will Testament works - so probably safe to exclude broker

@fasteddy516
Copy link
Owner

The LWT topic/message actually gets sent to the broker when the client first connects, and the server publishes that message on behalf of the client if at any point it disconnects unexpectedly.

Setting enable to low definitely won't trigger the LWT message, as the broker will see that as a clean, intentional disconnect. I can't remember the exact sequence that occurs during a program slot reset, but that probably appears as a clean disconnect as well. When I was testing the LWT message, I did a combination of physical cable disconnection, traffic blocking via firewall rules and full processor reboots (via the HW-R button) to simulate "dirty" disconnects, and it always worked in those scenarios.

I would definitely prefer to see the LWT message go out on a program restart, as that counts as a "dirty" disconnect in my mind. I will have to see what my options are for executing code before a program slot shuts down.

Technically, setting enable low generates a "clean" disconnect, but I could see adding a parameter that would allow you to enable automatic publishing of the LWT message when enable is set low. Many clients use the LWT topic as an "online/offline" indicator, and do this already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants