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

config: add support for lastWill and keep alive #468

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AmarOk1412
Copy link

By default, MQTT keep-alive is 1200 seconds and AWS broker add a 1.5x factor, so it takes generally 15 min to discover that a device is disconnected (30 min in the worst case)

This patch allow a user to configure a last will and change the default timeout (30 seconds will be the minimum authorized by AWS)

New config will have for example:

"last-will-topic": "things/myDevice/shadow/name/demo-shadow/update",
    "last-will-message": "{\"state\":{\"reported\":{\"connected\":false}}}",
    "connect-timeout": 0,
    "keep-alive": 30,

Motivation

[- Please give a brief description for the background of this change.

Modifications

Change summary

This is a WIP I guess, I don't know if this feature is wanted

Revision diff summary

If there is more than one revision, please explain what has been changed since the last revision.

Testing

"last-will-topic": "things/myDevice/shadow/name/demo-shadow/update",
    "last-will-message": "{\"state\":{\"reported\":{\"connected\":false}}}",
    "connect-timeout": 0,
    "keep-alive": 30,

You may want a rule to republish to the shadow topic, but with this config, instead waiting 30 minutes to get a KEEP_ALIVE disconnection, you can wait 45 seconds.

By default, MQTT keep-alive is 1200 seconds and AWS broker add a
1.5x factor, so it takes generally 15 min to discover that a device
is disconnected (30 min in the worst case)

This patch allow a user to configure a last will and change the
default timeout (30 seconds will be the minimum authorized by AWS)

New config will have for example:

	"last-will-topic": "things/myDevice/shadow/name/demo-shadow/update",
        "last-will-message": "{\"state\":{\"reported\":{\"connected\":false}}}",
        "connect-timeout": 0,
        "keep-alive": 30,
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

Successfully merging this pull request may close these issues.

1 participant