by toolz · 8y ago · 0 comments
texas https://gitlab.com/dgmcguire/texas is a library that brings development back to the server. You can integration test without headless browsers, get SPA-like UX without writing a line of JS and basically just write SSR apps with only adding a few lines of code to make you apps realtime and SPA-like.
It works by leveraging persistent connections (websockets) first page load is entirely SSR and subsequent updates are SSR, but only by V-DOM diffing html fragments, sending only the minimum amount of patch data over the wire.
Your apps will be faster, your development process will be faster with less code and removing all kinds of complex tooling.
Here's a todoapp that does all rendering SSR https://warm-citadel-23442.herokuapp.com/ - you can see just how fast it is even on a free tier of heroku - open it up in multiple clients and you'll see that all operations are realtime broadcasted too and believe it or not there's only like 3 lines of code you write to make that happen (plus all the code necessary to get a normal SSR app running)
V Dom is used by browser to update your page. The algorithm involved updates only the changed parts instead of the traditional way of updating the whole page. So, I’m not sure how ‘minimum data transfer over the wire’ is involved here. Can you please clarify? Not sure if you meant getting Json data from rest apis
> Texas keeps an elixir data structure representation on the server as a cache of client state and diffs against that.
Sorry, I don’t think that’s scalable. And, in a load balanced environment, you have to have a central server for this purpose
secondly as far as scaling goes you only need to broadcast extremely small messages (on the order of bytes, not kilobytes) across servers to tell clients to update themselves using their local caches
it's extremely scale-able
further texas only builds on top of HTTP semantics - meaning it can fall back to a stateless protocol at any point and the user won't even notice other than their app working a bit more slowly (but still working) for a few seconds while the websocket reconnects to a new node
I noted that you restart the server process each time you make a change to the elixir application and coming from the Clojure universe I have the following question: Is it possible to insetad of restarting the server program each time you make a change to it's source code instead modify the program as it is running?
This is usually how I work on my Clojure programs and I find that doing that which results in near instant feedback while I am programming.
PS I'm really happy that you called out "graceful degredation to an application that continues to function in the abscence of any JS.".
I wish HN allows me to search through all the post I have viewed or favourite, I am pretty sure I asked a similar question or saw something similar with Rails.
Edit: Found it. ( Not Really similar though)
the first page load is just a typical SSR webpage though - so compression could be applied just as easily as any other SSR webpage