Closed cgarciae closed 8 years ago
@cgarciae Did you end up getting this to work? You said in your SO question that it ended up being a shelf problem and now it's fixed. Also what is the option you had to enable to get it to work?
I ended up asking on the shelf package, here's the answer https://github.com/dart-lang/shelf/issues/54
From SO: http://stackoverflow.com/questions/29238873/streaming-text-in-redstone-shelf It just occurred to me that it would make sense to stream strings, each representing an element from a database query instead of returning the whole list of them at the end of the process, this might get the first result earlier on the browser. So I tried to implement this with
Redstone
which usesShelf
. Here is my basic testJust for some context, the Linked-in guys use "text streaming" in a pattern they got from Facebook to render parts of the page quickly and insert some latter (as its available), they implement this in Playframework (Scala) where they use
Enumerables
which seem behave just like Dart streams. You can see it in this video.The problem with my code is that while I expected it to show
"hello"
after 1 second, and"chao"
10 seconds later. What I get is 11 seconds of waiting and then the complete text. As you see, I am responding aShelf.Response
with aStream<List<int>>
where eachList<int>
is just a the string from the original stream converted into bytes.Is this a Shelf problem/feature, or is Redstone messing around with the response and converting it to a future? Is there any work around?