In 
[Rosencrantz](http://forum.nim-lang.org///andreaferretti.github.io/rosencrantz/)
 I am trying to implement support for streaming responses with transfer 
econding chunked.

These can be used to stream large files, or to represent the case where the 
data for the response comes piecewise.

The handler to produce these responses should get as input some kind of stream. 
What datatype should I use to represent the stream? If all data was available 
at once, I could use an iterator. But I see that the support for async 
operations is **also** implemented on top of iterators, which are used to 
simulate coroutines.

I have the feeling that an iterator can somehow be used to represent an 
asynchronous stream - by making some smart ping pong between it and the 
procedure that consumes it - but I cannot quite put it down clearly.

Any ideas?

Reply via email to