[XHR2] Streamed send or receive

I'd like to hear from the WG if the following use cases or issues have been
discussed before.

1) When onreadystatechange is invoked as new response data is being
received, currently there is no way to clear any buffered responseText
(alike) that has already been consumed. The lack of such a capability will
force the server to disconnect to avoid memory overflow on the client-side,
e.g. when the server is streaming a large volume of text or binary data to
the client.

An example API to solve the above problem could be:

XMLHttpRequest.removeResponseText();      // return and clear any buffered
response data


2) Currently, request body has to be sent all at once. This is not desirable
when request data is computed from a streamed data source or from user
input. The lack of a programmatic way to send partial request data (as it is
being generated) will force the application to send multiple XHR requests.
Worse yet, it actually breaks the REST semantics of the target resource that
processes the "entire" POST body.

A simple API to solve this problem may look like:

XMLHttpRequest.sendPartialReply(data);

- Wenbo

Received on Thursday, 6 October 2011 07:57:59 UTC