uwebsockets icon indicating copy to clipboard operation
uwebsockets copied to clipboard

implement an asyncio version of the websocket class

Open RobertBlackhart opened this issue 5 years ago • 5 comments

This change allows the uwebsockets package to be used inside of a uasyncio application by using the StreamWriter and StreamReader classes.

The client and protocol logic is almost not touched at all other than to change the method of reading and writing.

RobertBlackhart avatar Feb 17 '20 02:02 RobertBlackhart

This looks pretty good. Truthfully, I wonder if this should be the default implementation. I would have made it the default implementation originally (there's a branch even), but asyncio wasn't implemented on the target ESP platform at the time. What do you think? There's not a lot of point in maintaining two implementations (truthfully I don't even maintain one implementation).

danni avatar Feb 18 '20 02:02 danni

I'm not sure about default vs. not. The times I've used websockets in past projects, it's always been in an asynchronous way. But if someone wanted to use them in a synchronous project and this was the default, they would have to do some gymnastics due to the async keyword.

RobertBlackhart avatar Feb 22 '20 20:02 RobertBlackhart

@RobertBlackhart Hello, have you tested it widely? Arey you crrently using your fork lib? I'm interested in using it. Or maybe you know about other alternatives to use websocket on Micropython (Pi Pico).

Thank you

busslina avatar Feb 10 '23 21:02 busslina

I'm afraid that the project that I made this change for was shelved. In my limited testing it was working, but I wasn't using it in anything I would call production-ready and I haven't even run it in a few years. Sorry I don't have much more experience I can offer besides what's in the diff and the thread here.

If you decide to try it, don't forget to update if it's working for you so that the next person has more to go on :)

RobertBlackhart avatar Feb 10 '23 21:02 RobertBlackhart

@RobertBlackhart okay, thank you. I will try to use the C/C++ way but if I achieve any improvement here I will let you know ;)

busslina avatar Feb 12 '23 18:02 busslina