-
-
Notifications
You must be signed in to change notification settings - Fork 2
Discussion about Future of Rendering via Server and Client
Frank Lemanschik edited this page Dec 1, 2018
·
1 revision
The response object is a writable stream. Just write to it, and Express will even set up chunked encoding for you automatically.
response.write(chunk); You can also pipe to it if whatever is creating this "file" presents itself as a readable stream. http://nodejs.org/api/stream.html
and with that + deffered async stuff in html we even replace http push
<script type="module">, , <script defer src="script.js">, <script async src="script.js"> i don't write now about what is right when but this is incremental rendering fully control able for every situation. I will only fast talk about the rel="preload" with css as many could think this is simply a none supported type to load the css async but it is a supported type that faster fetches as a none supported media type. And script type module is also always async JS that is none blocking!!!!! @justinbmeyer Contributor justinbmeyer commented 5 days ago Frank, you have to write out in document order. Incremental rendering has no such limitation. The reason it doesn’t exist is likely because you would need a DOM-based rendering template engine. Those don’t exist server-side. @frank-dspeed Contributor frank-dspeed commented 4 days ago • @justinbmeyer nodejs has many dom based rendering engines 1 that would work is chromium headless firefox headless and so on but you would need the right rendering engine for the right request header this will not be performant. I have runned tests with caching prerendered pages per engine rendered serverside by the engine on request and that was not performant and also not a good idea as the rendering must happen in the browser version also and then also need to do that best device specific the best method in performance and compatiblity is to send out html from the server. I agree with your point of writing out html in order but that is not a bad thing at all for text from databases its a great fit as this can also be streamed. @frank-dspeed Contributor frank-dspeed commented 4 days ago • @justinbmeyer maybe i should also point out about The google Material Design Expirences that show the fact that slow loading but right timed is better then Instand loading! Examples: Click Image Fade Slow so the user Expirence is smooth All the stuff about Emotions on loading Summary: Render out Ordered HTML with a Skeleton https://blog.iamsuleiman.com/wp-content/uploads/2017/02/linkedin-skeleton-screen-loading.png Let JS Do the rest! For Search engines you render out for example the real final image tag a JS Script catches on inserted of the element and replaces it instant with the right skeleton view and that will replace them self with the original as loadedLastEdited by Frank Lemanschik status Draft 2019