=[xhr]

AFAIK, there is currently no way of using XMLHttpRequest to make a POST
using Transfer-Encoding: Chunked.  IMO, this would be a very useful
feature for repeatedly sending short messages to a server.

You can always make POSTs repeatedly, one per chunk, and arrange for the
server to "glue" the chunks together, but for short messages this
process adds a lot of overhead (a full HTTP request per chunk, with full
headers for both the request and the response).  Another option would
using websockets, but the protocol is no longer HTTP, which increases
complexity and may bring some issues.

Chunked POSTs using XMLHttpRequest would be a much better option, were
they available.  An elegant way of integrating this feature in the API
would be adding a second, optional boolean argument to the send()
method, defaulting to false, that, when true, would trigger chunked
uploading;  the last call to send() would have that argument set to
true, indicating the end of the object to be uploaded.

Is there any chance of such feature getting added to the standard in the
future?

Rui Prior

Received on Monday, 17 November 2014 14:24:45 UTC