ResponseStream.WriteAsync method
Sends one piece of the body, and completes when Isoplane has accepted all of it.
public ValueTask WriteAsync(ReadOnlyMemory<byte> bytes,
CancellationToken cancellationToken = default)
| parameter | description |
|---|---|
| bytes | The bytes to send. Do not change them until the returned task completes. An empty buffer sends nothing. |
| cancellationToken | Stops the handler writing to a client that has gone away; pass Aborted. It is checked before the write begins and again when it finishes; a write in progress is not interrupted. |
Exceptions
| exception | condition |
|---|---|
| InvalidOperationException | Complete has been called, or the previous write has not finished. |
| OperationCanceledException | The token was cancelled. |
| IOException | Isoplane could not accept the piece. |
Remarks
Await each write before starting the next. Awaiting is what keeps the handler from producing output faster than it can be sent.
Once the client has gone away, a write discards its piece and completes, unless its token is cancelled.
See Also
- class ResponseStream
- namespace Isoplane