Skip to content

feat(http): implement streaming upload/download #2795

@jeffbcross

Description

@jeffbcross

A user should be able to provide observers as part of a Request or RequestOptions object in order to receive progress updates and chunks of data for uploading and downloading of data.

Download observers will receive Responses, while upload observers will receive some form of Progress Event

To support different semantics of subscriptions between RxJS Observables and Dart Streams, an Observer implementation should be provided which will translate nicely to both platforms.

var myObserver = new Observer(res => this.progress = res.bytesLoaded / res.totalBytes);
http.request('https://foo', {
  downloadObserver: myObserver,
  uploadObserver: null
}).subscribe(res => this.finalResponse = res.json());

The Response Observable returned from Http should still emit a single Response value and complete when the connection closes.

In order to perform the request without requiring a subscription on the Response Observable this feature would also require providing a means of specifying that the request should be executed immediately. This should be an additional property of Request and RequestOptions, name TBD.

These observers can be tested with the MockBackend, using methods called mockUpload and mockDownload.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort3: weeksfeatureLabel used to distinguish feature request from other issues

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions