[GH-ISSUE #353] Feature request: websocket heartbeat and/or ping/pong response #760

Closed
opened 2026-03-20 18:12:39 +01:00 by sascha_hemi · 1 comment
Owner

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.

  1. Implement a periodic heartbeat message every (for example) 30 seconds that contains simple AP info (or something else better suited).
  2. Implement a function that will allow a connected websocket client to send a ping, where the AP responds with a pong. The pong could contain the same simple AP info as mentioned in point 1.

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

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. 1. Implement a periodic heartbeat message every (for example) 30 seconds that contains simple AP info (or something else better suited). 2. Implement a function that will allow a connected websocket client to send a ping, where the AP responds with a pong. The pong could contain the same simple AP info as mentioned in point 1. **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
sascha_hemi added the enhancement label 2026-03-20 18:12:39 +01:00
Author
Owner

@nlimper commented on GitHub (Sep 4, 2024):

A heartbeat is already there: the sys message 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}}

<!-- gh-comment-id:2328209524 --> @nlimper commented on GitHub (Sep 4, 2024): A heartbeat is already there: the `sys` message 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}}`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/OpenEPaperLink#760