Replies: 2 comments 1 reply
-
You could start a background task to do the periodic sends and keep the main request handler blocked on the receive loop. Would that work? |
Beta Was this translation helpful? Give feedback.
0 replies
-
This would work, yes! I was unsure where the "ws" object actually lives and how to consider situations in which more than client connects. To avoid this complication I tried to keep it in this one handler like the example |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, while experimenting with microdot and websockets on esp32c3 I came across a question and would be glad to get your feedback.
I checked the basic websocket example: await message and send back, ok so far.
My use case looks a bit different:
On the same websocket I need to 1. wait for incoming messages and 2. periodically send messages to client (w/o client initiating).
Wondering how this can be realized in elegant way, the normal asyncio wait function allowing to wait for the first coroutine to return (either message received or new message in queue to be sent to client) seems not available on micropython.
Thank you for any hints!
Beta Was this translation helpful? Give feedback.
All reactions