Persist¶
Maintains a persistent websocket connection.
-
lomond.persist.
persist
(websocket, poll=5, min_wait=5, max_wait=30, ping_rate=30, exit_event=None)¶ Run a websocket, with a retry mechanism and exponential back-off.
Parameters: - websocket – A
Websocket
instance. - poll (float) – The websocket poll rate, in seconds.
- min_wait (float) – The minimum time to wait between reconnect attempts (seconds).
- max_wait (float) – The maximum time to wait between reconnect attempts (seconds).
- ping_rate (float) – Delay between pings (seconds), or 0 for no auto ping.
- exit_event – A threading event object, which can be used to exit the persist loop if it is set. Set to None to use an internal event object.
- websocket – A
-
lomond.persist.
random
() → x in the interval [0, 1).¶