W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: [XHR] support for streaming data

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 10 Aug 2011 17:04:14 -0700
Message-ID: <CA+c2ei-0ZjCuvkhB5Uge2nZXWXGR5KAJLEvjCvS0rXn2wwgggQ@mail.gmail.com>
To: David Flanagan <dflanagan@mozilla.com>
Cc: public-webapps@w3.org
On Mon, Aug 8, 2011 at 9:36 PM, David Flanagan <dflanagan@mozilla.com> wrote:
> On 8/8/11 5:13 PM, Jonas Sicking wrote:
>> To solve this I propose we add two new values to .responseType:
>> "streaming-text" and "streaming-arraybuffer".
> I think this would be a very useful feature.  I only have naming nits:
> 1) What do you think of "textstream" instead of "streaming-text"?  Similarly
> for arraybufferstream (or ArrayBufferStream)

That works too. I was actually even thinking "chunked-text" or
"chunked-arraybuffer" since this is very different from a real Stream
object. (I'm sure we'll eventually add a .responseType="stream").

> 2) Is there any possible use case for streaming blobs?  If so, then I'd say
> that the streaming vs. non-streaming issue is orthogonal to the data type
> issue and there should be something like responseMethod = "stream" instead
> of responseType = "streaming-text"

I don't think there's a use case for streaming Blobs. The point of a
blob is to be able to get large pieces of data which you either don't
want to hold in memory all at once, or which you aren't going to use
immediately and so you don't want to keep it in memory.

The point of streamed XHR is to receive data as soon as it's available
so that you can process it right away. This also means that you're
likely going to get the data in pretty small chunks. Hence the use
cases for streaming are basically the direct opposite of the ones for

It also doesn't make sense for parsed formats, like XML, HTML or, if
we add it in the future, JSON, to use streaming. It's unlikely that
the contents of those can be delivered in chunks, and so it's better
that we'll just incrementally parse, which is already what happens.

/ Jonas
Received on Thursday, 11 August 2011 00:05:11 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:34 UTC