{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/6224","repository_url":"https://api.github.com/repos/aspnet/Mvc","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/6224/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/6224/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/6224/events","html_url":"https://github.com/aspnet/Mvc/issues/6224","id":225915595,"number":6224,"title":"Add Streaming API support to MVC","user":{"login":"davidfowl","id":95136,"avatar_url":"https://avatars3.githubusercontent.com/u/95136?v=4","gravatar_id":"","url":"https://api.github.com/users/davidfowl","html_url":"https://github.com/davidfowl","followers_url":"https://api.github.com/users/davidfowl/followers","following_url":"https://api.github.com/users/davidfowl/following{/other_user}","gists_url":"https://api.github.com/users/davidfowl/gists{/gist_id}","starred_url":"https://api.github.com/users/davidfowl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidfowl/subscriptions","organizations_url":"https://api.github.com/users/davidfowl/orgs","repos_url":"https://api.github.com/users/davidfowl/repos","events_url":"https://api.github.com/users/davidfowl/events{/privacy}","received_events_url":"https://api.github.com/users/davidfowl/received_events","type":"User","site_admin":false},"labels":[{"id":93054382,"url":"https://api.github.com/repos/aspnet/Mvc/labels/1%20-%20Ready","name":"1 - Ready","color":"CCCCCC","default":false},{"id":70264662,"url":"https://api.github.com/repos/aspnet/Mvc/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":96169357,"url":"https://api.github.com/repos/aspnet/Mvc/labels/needs%20design","name":"needs design","color":"006b75","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/aspnet/Mvc/milestones/37","html_url":"https://github.com/aspnet/Mvc/milestone/37","labels_url":"https://api.github.com/repos/aspnet/Mvc/milestones/37/labels","id":2623525,"number":37,"title":"3.0.0","description":null,"creator":{"login":"Eilon","id":202643,"avatar_url":"https://avatars3.githubusercontent.com/u/202643?v=4","gravatar_id":"","url":"https://api.github.com/users/Eilon","html_url":"https://github.com/Eilon","followers_url":"https://api.github.com/users/Eilon/followers","following_url":"https://api.github.com/users/Eilon/following{/other_user}","gists_url":"https://api.github.com/users/Eilon/gists{/gist_id}","starred_url":"https://api.github.com/users/Eilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eilon/subscriptions","organizations_url":"https://api.github.com/users/Eilon/orgs","repos_url":"https://api.github.com/users/Eilon/repos","events_url":"https://api.github.com/users/Eilon/events{/privacy}","received_events_url":"https://api.github.com/users/Eilon/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":1,"state":"open","created_at":"2017-07-05T17:23:02Z","updated_at":"2018-05-18T21:03:45Z","due_on":null,"closed_at":null},"comments":25,"created_at":"2017-05-03T08:33:27Z","updated_at":"2018-05-19T03:00:54Z","closed_at":null,"author_association":"MEMBER","body":"Streaming APIs are a thing and it would be great for MVC to support something out of the box that allowed streaming results back to the client. Web API had a `PushStreamContent` which was a bit lower level than most want (but we could still offer it as a building block). It should be possible to return an `IObservable<T>` or `IEnumerable<T>` (an eventually `IAsyncEnumerable<T>`) from a controller action and have those results be pushed back to the client as they are realized instead of being treated as a single response. \r\n\r\nHigh level areas to think about:\r\n\r\n- Formatting and conneg *could* also come into play here (but I'm not sure how useful it is). A client could request that they wanted JSON streaming or XML streaming (does anyone do that?). \r\n- Do we want to only allow streaming results or do we want to handle streaming input as well (chunked transfer encoding both ways).\r\n- Do we want to support framing and deframing the data on the wire so users don't have to? For example, lets say I wanted to use multipart mime as my framing format per T that was received or sent. Another example is server sent events, if I return an `IObservable<Person>` can that be framed in different ways based on what the client asked for (related to conneg?)\r\n- `IObservable<T>` doesn't do back pressure so at some point threads would get blocked. Do we try to push for `IAsyncEnumerable<T>` as the model? What about `Channel<T>` (that supports back pressure)? (corefxlab)\r\n\r\n/cc @rynowak @anurse "},"comment":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/comments/390373779","html_url":"https://github.com/aspnet/Mvc/issues/6224#issuecomment-390373779","issue_url":"https://api.github.com/repos/aspnet/Mvc/issues/6224","id":390373779,"user":{"login":"rynowak","id":1430011,"avatar_url":"https://avatars1.githubusercontent.com/u/1430011?v=4","gravatar_id":"","url":"https://api.github.com/users/rynowak","html_url":"https://github.com/rynowak","followers_url":"https://api.github.com/users/rynowak/followers","following_url":"https://api.github.com/users/rynowak/following{/other_user}","gists_url":"https://api.github.com/users/rynowak/gists{/gist_id}","starred_url":"https://api.github.com/users/rynowak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rynowak/subscriptions","organizations_url":"https://api.github.com/users/rynowak/orgs","repos_url":"https://api.github.com/users/rynowak/repos","events_url":"https://api.github.com/users/rynowak/events{/privacy}","received_events_url":"https://api.github.com/users/rynowak/received_events","type":"User","site_admin":false},"created_at":"2018-05-19T03:00:54Z","updated_at":"2018-05-19T03:00:54Z","author_association":"MEMBER","body":"@cdebergh - if you're interesting trying something like this out, you would probably want to start by implementing a method that returns either `IEnumerable<Task<T>>` or `IObservable<T>`. If you want to go the task route, you'll need to make each `Task<T>` wait until the next chunk is available.\r\n\r\nThen implement an output formatter that iterates and processes each chunk as it's available - but the key is that `WriteAsync` [here](https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.Abstractions/Formatters/IOutputFormatter.cs#L26) needs to return a `Task` that won't complete until you've written all of the chunks. \r\n"}}
{"actor":{"display_login":"rynowak"}}