-
Notifications
You must be signed in to change notification settings - Fork 213
Response streaming #89
Comments
Definitely we'd like hypernova to support response streaming, and when available, to take advantage of |
React 16 is out in beta right now I believe and the stream/async rendering has already landed so feel free to take it for a spin and report back what works/doesn't work/what you'd like to work/how @Inkdpixels |
What's the benefit of rendering to stream when all the markup has to be buffered to send the HTTP response to the hypernova client? Am I missing something here? |
@patrick-mcdougle it doesn't all have to be buffered; by simply beginning to buffer it, chunks can be immediately sent down to the client, before the rest is ready. |
@ljharb But the client is almost always some legacy application, which needs the JS view rendered. The hypernova client isn't ever a browser, is it?! |
There’s sort of a client (browser), a combo client/server (whatever talks to hypernova and the web), and a server (hypernova). The webserver absolutely might support streaming - rails 4+, for example - and the browser always does - so hypernova would have to stream also to be able to support streaming through the entire process. |
I guess, but the whole response from hypernova will have to be re-tooled, since the response is JSON. You can't json_decode a partial JSON object...I guess I'm not saying it's impossible, but is it worth the effort? |
indeed, we'd have to use json streaming, or something similar. I'm not sure if it's worth the effort yet - but it seems likely. |
Well - looking from outside - you can indeed decode a JSON Object using JSONStream - I made quite a lot implementations using that in reading - in writing my Scramjet..toJSONArray will easily deliver a JSON array (or object via another method) items in realtime while still provinding a proper JSON output for legacy and API use. Can you elaborate a little on the code - maybe find a nice place to make a proof of concept? I could try and help. |
As of React 16 a new method
renderToStream()
method was introduced. I first though of creating a feature request issue at airbnb/hypernova-react but after taking a look at the code it seems that more ground-work needs to be done at the server itself to support streams in the first place.@goatslacker mentioned in #22 that there are plans to support streams and even async rendering, it would be interesting if this was already started by anyone or if we could support you guys on this feature.
In the latter case it would be nice if we could collect all ideas/hints here on how to implement this feature correctly.
The text was updated successfully, but these errors were encountered: