Closed olijeffers0n closed 1 year ago
Im not much help with asyncio stuff but websockets
claims to support async, not sure if you have tried it already.
https://websockets.readthedocs.io/en/stable/reference/asyncio/client.html
Looks to be async friendly, just not event-driven. This is something I could look at implementing myself though
A good write up of why websockets is a good choice https://betterprogramming.pub/websockets-and-asyncio-beyond-5-line-samples-part-1-ddf8699a18ce
Another thing I would like to look at, instead of the horrible get_response
, maybe an implementation using asyncio.Event
s to work on wait / set basis. The only thing I can think of, is that this will potentially fail to retry pending messages, however this should be fine as we can just have some sort of background worker task
A WebSocket library that has full async support would allow me to remove some of the event loop garbage by just awaiting the coroutines directly. Also, If it was properly event-driven I would be able to abstract the reconnection logic.