olijeffers0n / rustplus

Rust+ API Wrapper Written in Python for the Game: Rust
https://rplus.ollieee.xyz/
MIT License
102 stars 28 forks source link

Feature Request - Change WebSocket libraries to one which properly supports async read/writes #45

Closed olijeffers0n closed 1 year ago

olijeffers0n commented 1 year ago

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.

s4w3d0ff commented 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

olijeffers0n commented 1 year ago

Looks to be async friendly, just not event-driven. This is something I could look at implementing myself though

psykzz commented 1 year ago

A good write up of why websockets is a good choice https://betterprogramming.pub/websockets-and-asyncio-beyond-5-line-samples-part-1-ddf8699a18ce

olijeffers0n commented 1 year ago

Another thing I would like to look at, instead of the horrible get_response, maybe an implementation using asyncio.Events 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