ngrunwald / ring-middleware-format

Ring middleware for parsing parameters and emitting responses in JSON or other formats
163 stars 49 forks source link

Large (streaming) response support #41

Open RickMoynihan opened 9 years ago

RickMoynihan commented 9 years ago

Hi I'm not sure if this is supported or not, but as far as I can tell this middleware doesn't support (memory) efficient serialisation of large responses.

From looking at the code it seems that objects are fully converted into in memory strings before being returned to the web server. Is this a fair assessment?

Would it be possible to support streaming responses with this middleware?

Perhaps by allowing certain handlers to return a piped-input-stream instead of a String?

Deraen commented 9 years ago

Yes this sounds like a good idea.

I'm currently working on a major refactoring and after that is completed I'm thinking I'll take a look into this.