Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Router: allow methods to return an async-iterator or a readable stream #122

Closed
bajtos opened this issue Apr 12, 2017 · 3 comments
Closed

Comments

@bajtos
Copy link
Member

bajtos commented Apr 12, 2017

Right now, Controller methods are returning a single response object that's later written to the HTTP response body.

Let's add support for two more advanced response modes:

  • A method returning an async iterator instead of in-memory array instance - see e.g. KeyValueModel.iterateKeys

  • A method returning a readable stream. The stream can be either "regular" text/binary stream, but also a stream in object mode, where the framework is expected to serialize the objects to JSON/XML/etc.

@bajtos
Copy link
Member Author

bajtos commented Apr 12, 2017

In #97 (comment), @raymondfeng suggested we may want to leverage https://github.com/dominictarr/JSONStream in the implementation.

@raymondfeng
Copy link
Contributor

+1. A lot of DB drivers allow row by row access to a large result set.

From the programming model perspective, we should explore the possibility to support:

  1. Streams
  2. Async Iterators (push)
  3. Generators (pull)
  4. Pub/sub

@bajtos
Copy link
Member Author

bajtos commented Dec 15, 2017

I am closing this issue because we are not going to have time to work on this in the next 6-9 months. However, we are happy to accept a pull request contributing this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants