stream body
#3005
-
Summaryim trying to stream the body but everything i can find about it is from a few years ago and outdated async fn stream() -> impl IntoResponse {
let (tx, mut rx) = channel::<Bytes>();
tokio::spawn(async move {
for i in 1..100 {
tx.send(Bytes::from(format!("number: {i}")));
tokio::time::sleep(Duration::from_millis(500)).await;
}
});
Body::from_stream(rx)
} axum version0.7.7 |
Beta Was this translation helpful? Give feedback.
Answered by
piquu
Oct 25, 2024
Replies: 1 comment 5 replies
-
When asking for help, you might want to also include the error message. I don't know what channel you're using but the tokio ones don't implement |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i got it working. the issue was that i set the channel buffer to
usize::MAX
. tysm for helping me