-
-
Notifications
You must be signed in to change notification settings - Fork 566
Open
Labels
Description
Custom exponential backoff
In asyncio client, there was introduced option to use an infinite asynchronous iterator to reconnect automatically on errors, more in docs.
There were set constants for exponential backoff: client.py. But it's too slow for my use case. I would like to shorten it and I would prefer some cleaner way than this:
auto_reconnect = websockets.connect(...)
auto_reconnect.BACKOFF_INITIAL = 1
async for websocket in auto_reconnect:
try:
...
except websockets.ConnectionClosed:
continue
Ideally it should be a parameter of the connect
function.