You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Response<ResponseBody> rs;
rs =awaitDio().get<ResponseBody>(url,
options:Options(responseType:ResponseType.stream), // set responseType to `stream`
);
print(rs.data.stream);
rs.data?.stream
.listen((event) {
log(event);
});
Server sends chunked data (10 chunks during 10 seconds, so 1 chunk every second), but this call
awaitDio().get<ResponseBody>(url,
options:Options(responseType:ResponseType.stream), // set responseType to `stream`
);
awaits just after stream is done, so I receive all chunks in one moment. This await waits 10 second and just then stream.listen will be run and I will receive all 10 chunks in one moment.
But I want to receive chunks right at the moment when server is sending them.
The text was updated successfully, but these errors were encountered:
Pepslee
changed the title
Chunked stream doesn't work correct
Chunked stream reading doesn't work correct ( Dio().get<ResponseBody> Options(responseType: ResponseType.stream))
Jan 22, 2023
From Dio documentation:
Server sends chunked data (10 chunks during 10 seconds, so 1 chunk every second), but this call
awaits just after stream is done, so I receive all chunks in one moment. This
await
waits 10 second and just thenstream.listen
will be run and I will receive all 10 chunks in one moment.But I want to receive chunks right at the moment when server is sending them.
The text was updated successfully, but these errors were encountered: