mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 00:04:28 +01:00
[GH-ISSUE #353] Feature request: websocket heartbeat and/or ping/pong response #1313
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DrBlokmeister on GitHub (Jul 25, 2024).
Original GitHub issue: https://github.com/OpenEPaperLink/OpenEPaperLink/issues/353
Is your feature request related to a problem? Please describe.
For the Home Assistant integration, it is not easy to detect if the connection is still alive. As far as I understand, the OEPL HA integration listens for websocket events, but these are only sent when a tag or the AP updates, not periodically. Therefore it is not strictly possible to detect if the websocket has quietly disconnected or if nothing has updated for some time. For me this means that sometimes the Home Assistant integration stops working without raising any errors or attempting to reconnect.
Describe the solution you'd like
I would like a way to detect if the websocket is still open. This can be done in two ways, both can be complementary.
Describe alternatives you've considered
A different option is to work around this implementation in the Home Assistant OEPL integration instead by assuming that the connection has been dropped if no messages have been received for (for example) 5 minutes. However, this seems a bit ugly to me, especially since no websocket messages could also mean that everything is fine, but no updates have been detected.
I could also imagine that a periodic update is triggered by an update of "currtime". However, I assume that this also relies on a background process that could also fail even though the websocket itself is still connected.
Additional context
None
@nlimper commented on GitHub (Sep 4, 2024):
A heartbeat is already there: the
sysmessage is sent every 5 seconds via the websocket connection:{"sys":{"currtime":1725437579,"heap":192304,"recordcount":27,"dbsize":5290,"littlefsfree":5505024,"psfree":8340355,"apstate":1,"runstate":2,"rssi":-79,"wifistatus":3,"wifissid":"sensors","uptime":2492}}