Websocket keepalives
Meatballs1 opened this issue · 0 comments
The current websocket-client
library is used to manually call recv()
in a loop. We don't have any keepalive mechanism and it appears that a device going offline leaves the connection open indefinitely as far as the websocket
is concerned.
Have implemented a temporary work around by using TCP keepalives (#41) but this is not platform agnostic. Should make use of websocket keepalives as per https://websocket-client.readthedocs.io/en/latest/examples.html#ping-pong-usage.
The suggested mechanism for performing long lived connections is to use the run_forever()
method and on_message
event handlers. We should migrate to this approach, or look at using a different websocket library (e.g. https://websockets.readthedocs.io/en/stable/). This may require further work to integrate with sslpsk
however.