NG Snakeoil: A Technology Walkthrough
Connecting All The Dots
This is how the old system used to work:
Your browser requests the GUI from the SnakeoilOS machinie. The old SnakeoilOS 0.1.x WebApp will take it’s own sweet time to run everything, and when it’s done it sends a static HTML back to the browser. Your browser only need to display this static HTML page. In this setup the SnakeoilOS machine does all the work, and the browser is doing anything useful.
The above is a vicious cycle. To update the GUI, or get new content, you have to continuously make a new request, and the SnakeoilOS has to do all the work, and then send back a static HTML page for the browser to display. This is not an ideal setup. If the request takes a minute to complete, your browser will sit there doing nothing for one minute (you cannot do anything with it). The SnakeoilOS computer is doing all the work, meaning it’s wasting CPU time that can be better used for audio playback (i.e. your SnakeoilOS is busier and have a higher latency).
Not good at all.
Meanwhile, the new design absolves all the problems described above. Here’s the new design:
In SnakeoilOS 1.0.0 and beyond. When you load the WebApp, the browser request the GUI from the SnakeoilOS once (in most cases), and then it runs on the browser (via the browser’s JavaScript engine). This is why when you first load the web page, you’d see a “loading” animation that will take a few seconds.
Now you can navigate your way around the WebApp, and it will communicate with the RESTful server to grab any data it needs, or to process any configuration changes you make. Communications between the two is now working in asynchronous mode, there is no painful waiting time anymore. Sorry for the wait!
Already you can see how this new design means the SnakeoilOS machine is no longer working "as hard” when compared to 0.1.x. The whole architecture is simplified, made modular and that opens up a whole new world of possibilities.
SnakeoilOS 1.0.0 is how SnakeoilOS should be, and this is only the beginning!