Sending Data From An Async Generator To A Websocket #8250
-
|
Description In my FastAPI log I see data printed in realtime, but nothing appears on the other end of the websocket until Additional context Also, this is my first foray into async python, so I could just be doing everything completely wrong! I'm pretty sure I'm not...but I really have no idea what I'm doing here :). |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
|
maybe dumb question but are you sure |
Beta Was this translation helpful? Give feedback.
-
|
Nope, not a stupid question, looks like that was the problem. I was thrown off since I was seeing the right data in my console log so I assumed it was doing the right thing. Looks like |
Beta Was this translation helpful? Give feedback.
-
|
Great to see you solved your problem @iwoloschin. You rock @euri10! Thanks for all your help here. |
Beta Was this translation helpful? Give feedback.
-
|
How to solve this problem please. @iwoloschin |
Beta Was this translation helpful? Give feedback.
-
|
I solved this problem. I used |
Beta Was this translation helpful? Give feedback.
-
|
Just for further reference, I had the same problem but I wanted to stream the generator as soon as it comes, without a delay. Like @CurryGaifan, I had to add |
Beta Was this translation helpful? Give feedback.
maybe dumb question but are you sure
read_log(log_filename)is async ?from memory aiofiles is a nice library to use for that.