Skip to content

[browser][wasm] Request Streaming upload via http handler #36634

Closed

Description

@kjpou1

During the initial review of the browser wasm code integration it was brought to the attention that the request content may not be sufficient in its current state.

There needs to be more investigation into whether there is a way to stream the request content. The issue being that not being able to handle this scenario may result in the buffering of huge amounts of data is some scenarios.

These scenarios need to be identified and solution coded if there is a way to achieve this using the browser API.

Initial investigation leads to some sort of wrapping the javascript Streams API and exposing it in some way via .NET stream.

Model being:

fetch('/', {
  method: 'POST', 
  body: new ReadableStream({
    pull: function(controller) {
      console.log('pull called!');
      controller.enqueue('Some data...');
    }
  })
});

Right now this does not seem to work as per the discussion here: whatwg/fetch#425 (comment)

As well as multiple issues outstanding.

Also to keep in mind the streaming API is still marked experimental in the documentation.

Activity

  1. added
    untriaged
    on May 18, 2020
  2. added
    arch-wasm
    on May 18, 2020
  3. self-assigned this
    on May 18, 2020
  4. removed
    untriaged
    on Jun 30, 2020
  5. added this to the Future milestone on Jun 30, 2020
  6. guardrex commented on Feb 4, 2023

    @guardrex

    @pavelsavara ... I'm in the process of adding remarks to the Blazor WASM File uploads topic to alert readers to the limitation of the current BrowserHttpHandler implementation for large file uploads.

    Pavel, I'll ping you as a reviewer, as I have a question about this issue cross-link in the new text. The PR will be up on Monday, 2/6.

  7. pavelsavara commented on Feb 6, 2023

    @pavelsavara
    Member
  8. campersau commented on Feb 6, 2023

    @campersau
    Contributor
  9. pavelsavara commented on Feb 6, 2023

    @pavelsavara
    Member

    It is supported by Chrome / Edge (https://developer.chrome.com/articles/fetch-streaming-requests/) but not by Firefox (mozilla/standards-positions#663) or Safari (WebKit/standards-positions#24)

    Thanks @campersau!

    We could possibly implement it and hide it behind option similar to WebAssemblyEnableStreamingResponse we already have.
    @lewing Do you see this is as Net8 priority ?

  10. modified the milestones: Future, 9.0.0 on Jul 11, 2023
  11. ghost added
    in-pr
    on Aug 30, 2023
  12. ghost removed
    in-pr
    on Sep 1, 2023
  13. ghost locked as resolved and limited conversation to collaborators on Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmarea-System.Net.Http

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions