News for hackers. Stuff that matters.
Re:Ask HN: How long will it take for GraphQL(or else) to tak... by PaulHoule on Monday May 03, 2021 @09:58AM (#27025128)
On one level never, so long as http is the dominant protocol.

For some things REST is appropriate, for other things it is not.

I am impressed with websockets; it's easy to make a web page that controls your smart lights, stereo volumes and such where the updating is symmetrical: not only does clicking on the HTML button toggle the light, the web page changes when the light is toggled from a different switch.

With the right backend a business application could do the following: you are looking at a customer record that shows the order hasn't shipped yet, the page updates the instant the order is shipped instead of requiring a reload.

The other thing I would look at is web workers, service workers, and indexed storage. One scenario is:

you want to read the manuals for your favorite programming language on your computer disconnected from the net; a web app creates a Service Worker that downloads all the web pages as a brotli tar file (not ZIP for many reasons) and stores them in IndexedStorage on your browser: the Service Worker then acts like an http server integrated that serves the pages of the manual.

If you want to avoid the baggage of http you can also create a Web Worker and communicate with it with JSON messages, a little like having a local "websocket server".

Those tech have not been used much because the coding is tricky and the most popular framework so far is

https://developers.google.com/web/tools/workbox/

which really just complicates the cache behavior of the browser -- the probability that workbox will really speed up your app is about 0.01%, compared to something like the "solid compressed tar" approach which will have much better performance you can feel. (Like try the quarter mile in a Dodge Viper instead of a Honda Fit)

One could even picture a news site, for instance, that uses push updates, websockets, or polling, to update a user's local copy of the site.

There are no comments on this comment yet.