How to respond streaming data from Receiver? #397
-
I want to respond streaming data continuously gotten from Receiver. I found axum::response::Sse that might be usable. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can use However these days it's more common to use websockets than sse. More details on that here. There is a complete chat app example here. |
Beta Was this translation helpful? Give feedback.
-
Thanks for it. Yes, I did various trial, but none of them worked fine. So that I am considering to use websockets. There are some of my trial.
But I got the compile error.
So that, I changed
However, I got the errors.
|
Beta Was this translation helpful? Give feedback.
You can use
ReceiverStream
to convert the receiver into a stream and then use SSE similar to what's shown here.However these days it's more common to use websockets than sse. More details on that here. There is a complete chat app example here.