'ASP.NET Core API Endpoint which delivers a Stream instead of big JSONArray

I have a pretty big list of objects, which needs to be received fast from the client. Currently it takes about 2-4 seconds. I now try to use streams to send chunks (e.g. 100 objects in each) I know that GRPC can use streams but in ASP.NET core, how can I achieve this? The normal ASP.NET has PushStreamContent which is not available in Core. Any solutions out there? I can't really find a proper one online.

So what my Controller currently looks like:

 [HttpGet]
 public async Task<ActionResult<IEnumerable<Price>>> GetPrices()
 {
     return await _context.Prices.ToListAsync();
 }

This list currently contains around 18700 Items but this number will increase by time.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source