<div class="gmail_quote">On Fri, Oct 21, 2011 at 11:59 AM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
In my little project (SCouchDB), i also had to deal with same situation:<br>
 - a couchDB server API using a long-lived connection(s) to notify<br>
observers about database updates,<br>
which can be used for replication of data or watching for updates etc.<br>
<br>
So, the idea is to not wait till all data will arrive upon HTTP<br>
request, but answer a stream (which represents a contents),<br>
once http response header is arrived. Then user code may request<br>
#contents, which will force stream to read all data upon<br>
connection is closed (or up to content length, if it specified), or<br>
user may consume data in portions by using a #next /#next: messages to<br>
stream.<br>
<br>
This is useful also for cases, when amount of data to transfer is big,<br>
so you don&#39;t collect it into a huge buffer and only then hanging over<br>
to user,<br>
but you letting a user to process data in portions, once it arrives via wire.<br>
<div><div></div><div class="h5"><br></div></div></blockquote><div><br><br>Did you use Zinc in SCouchDB, or you were working with plain sockets?<br><br>thanks,<br><br>Davorin<br><br></div></div>