You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with ReadableStream in JavaScript, one can call ReadableStreamDefaultReader.cancel() which will triger request cancellation if the server is still streaming.
In Blazor WebAssembly this is currently not possible, as WasmHttpReadStream uses the reader only to advance the ReadableStream and on dispose only diposes the references to JavaScript objects. It looks like this functionality could be achieved by adding call to cancel() in WasmHttpReadStream.Dispose.
private sealed class WasmHttpReadStream : Stream
{
...
protected override void Dispose(bool disposing)
{
if (!(_reader is null))
{
_reader.Invoke("cancel");
}
_reader?.Dispose();
_status?.Dispose();
}
...
}
Such a change would be a great improvement for scenarios like consuming async streams coming from servers.