websockets icon indicating copy to clipboard operation
websockets copied to clipboard

Provide an example of using an in-process queue

Open DarkArc opened this issue 5 months ago • 4 comments

DarkArc avatar Sep 05 '25 13:09 DarkArc

Thank you for the PR, it's a good starting point. The code requires a few changes (e.g. async for vs. for). I'll adjust it to make it work then merge.

aaugustin avatar Sep 05 '25 16:09 aaugustin

iter websocket should be async

async def consumer_handler(websocket):
-    for message in websocket:
+    async for message in websocket:
        await queue.put(message)

liuyangc3 avatar Sep 19 '25 10:09 liuyangc3

Yeah, I thought @aaugustin was going to fix that little bit based on his comment. Anyways, fixed and squashed.

DarkArc avatar Sep 19 '25 14:09 DarkArc

I intended to do it but didn't work on this projects for a few weeks :-|

aaugustin avatar Sep 19 '25 17:09 aaugustin