Since IAsyncEnumerable is not available in ASP.NET Web API (.NET 4.8). Is there any alternative so that I can stream json data?
I wanted to stream an array of json data instead of sending it as a whole.
In .NET Core, I can do the following:
async IAsyncEnumerable<String> getValues() {
yield return "test";
for(int i = 0; i < 3; i++) {
await Task.Delay(1000);
yield return "Test " + i;
}
}
app.MapGet("/addmq/v1/inventory/databases/{database}/akastream2", () => {
return getValues();
});
And then I can use curl -N then I can see each string in the terminal every second. How should I do that in .NET Framework 4.8?