2 ms·
I think the complexity/level is too high. You could easily do the chat from the example video in vanilla JavaScript with a Node.js server and Websocket, that wo
by z3t4 6y ago
I think the complexity/level is too high. You could easily do the chat from the example video in vanilla JavaScript with a Node.js server and Websocket, that would also be faster and smaller.
The video was however a great tutorial, although a bit too fast. (I had to pause and replay a few times). But it did not sell me on the concept.
A more simple approach would be to send a (head) request to the server every 5 second asking if the source/HTML/state has changed. Then do a sophisticated diff/replace of the DOM (like in React, but without React) making the smallest change to the DOM as possible (only change what was updated). eg. no full page refresh, nor iframes. (and also send a diff over the wire, not the full page).
If you would make the app fully functional/pure you would then be able to cache many states (input->output) and predict them on the client and prefetch, for example a link click, would instantly do the DOM/diff and update the page with the new content. For example in a tic-tac-toe game you could pre-render all states and have the client pre-fetch them.