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

Add 5 min heartbeat to the CloudIoT WebSocket connection #584

Merged
merged 5 commits into from
Mar 1, 2024

Conversation

ludeeus
Copy link
Contributor

@ludeeus ludeeus commented Feb 29, 2024

In most cases (where we have a healthy connection), this will never hit because of the socket pings (which will reset this).
This is just here to mitigate problems where the instance has not received any messages in > 5 minutes.

If this is invoked, the reconnection logic will trigger.

@ludeeus
Copy link
Contributor Author

ludeeus commented Feb 29, 2024

I only tested this with the primary connection. As this is in the base it can have other side effects, moving it to draft until I'm done checking the others.

@ludeeus ludeeus marked this pull request as draft February 29, 2024 13:01
@ludeeus ludeeus marked this pull request as ready for review March 1, 2024 06:14
@@ -75,6 +75,11 @@ def package_name(self) -> str:
"""Return package name for logging."""
raise NotImplementedError

@property
def ws_heartbeat(self) -> float | None:
Copy link
Contributor Author

@ludeeus ludeeus Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the CloudIoT class can use this for now, so made it a property (like ws_server_url) to allow those who inherit this base class to override it, with a default to None (current behavior).

@ludeeus ludeeus changed the title Add 5min heartbeat to WebSocket connections Add 5 min heartbeat to the CloudIoT WebSocket connection Mar 1, 2024
@ludeeus ludeeus merged commit 7c83d5d into master Mar 1, 2024
3 checks passed
@ludeeus ludeeus deleted the iot-heartbeat branch March 1, 2024 11:12
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.

2 participants