Stream Request Handlers behave exactly like regular request handlers but return an AsyncEnumerable instead of a single value. This allows you to continously send data
or efficiently stream data until completion.
Creating a Stream
First off, let’s create our request contract.
Next up, let’s create a handler to process our requests.
Now to wire up our handler with DI
Last - let’s call our stream
Middleware
Stream middleware is a bit different than request/event middleware in that it survives the entire stream allowing you to post process the stream data.
Here is a simple example of a stream middleware that converts all items to uppercase: