-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Wasm] WebAssemblyHttpRequestMessageExtensions should be part of the BCL #77904
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @dotnet/ncl Issue DetailsBlazor provides as part of Those extensions do not have anything special to Blazor (even if the package depends on Blazor), and would benefit for being available in BCL, so that non-blazor frameworks (Such as Uno Platform) can benefit from those extensions without having to import those 4 types locally.
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsBlazor provides as part of Those extensions do not have anything special to Blazor (even if the package depends on Blazor), and would benefit for being available in BCL, so that non-blazor frameworks (Such as Uno Platform) can benefit from those extensions without having to import those 4 types locally.
|
Should we make request/response streaming opt-out instead of opt-in ? cc @campersau @maraf |
I would be good to start with perf measurements |
We have some WebSocket perf benchmark about copy buffer efficiency. But then this involves network latencies which are orders of magnitude bigger. |
For response streaming opt-out seems ok to me.
Since there is
Since response streaming seems to be supported everywhere it should be fine. |
I did some performance tests with a blazor webassembly app on .NET 9.0.100-rc.2.24474.11.
var buffer = new byte[Math.Max(1, size / 2)];
using var request = new HttpRequestMessage(HttpMethod.Get, $"http://localhost:5219/{size}");
request.SetBrowserResponseStreamingEnabled(streaming);
using var response = await new HttpClient().SendAsync(request, httpCompletionOption);
using var stream = await response.Content.ReadAsStreamAsync();
while (await stream.ReadAsync(buffer) != 0) {} |
As another +1 for considering changing the default here, #110287 is another case bit by the difference in behavior. var request = new HttpRequestMessage(HttpMethod.Get, url);
request.SetBrowserResponseStreamingEnabled(true);
using var response = await HttpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, ct);
var itemStream = response.Content.ReadFromJsonAsAsyncEnumerable<string>(ct); |
If changing the default isn't preferrable, I do think at the very least it would make much more sense than not to make it the default behavior for Edit: I assume that the reason for this is |
Blazor provides as part of
Microsoft.AspNetCore.Components.WebAssembly
a set of extensions (docs) that augment the features ofHttpRequestMessage
likeSetBrowserRequestCredentials
orSetBrowserRequestOption
specifically for WebAssembly.Those extensions do not have anything special to Blazor (even if the package depends on Blazor), and would benefit for being available in BCL, so that non-blazor frameworks (Such as Uno Platform) can benefit from those extensions without having to import those 4 types locally.
The text was updated successfully, but these errors were encountered: