Is Phoenix Liveview an existential threat to Clojurescript?

Hum… So I’m not sure what’s going on here?

What’s the socket going to do? There doesn’t seem to be any involvement from the server here no?

With that piece of JavaScript, you’re still having to write JavaScript now? Is this JavaScript somehow defined in Elixir code ?

I don’t think it’s a threat at all to Clojurescript, especially since a it’s more a ‘style’ of webapp that’s delivered with various languages, backends, etc, just as we do for SPAs, dynamic/static server rendered apps and what have you. Heck, most of the pieces are already out there to cobble something together in Clojure(script). Sente, some pimped out Hiccup, Coast on Clojure if you want rails’y conventions on the server, app/page state representation/diffing logic is well worked out in re-frame/fulcro, if you’re using datomic on the server you’ve got a change log, pathom should eventually have subscriptions, etc.

I have been considering making use of websocket and never considered this. Can I ask how widespread and in what contexts did you run into proxies that didn’t support websockets?

For what it’s worth, I’ve been running my SaaS business on websockets (Sente is such a great library for this in Clojure+ClojureScript) for the last 3 years or so, with about 5K users from around the world, and have yet to hear about a problem. But I might be saved by Sente’s AJAX fallback.

1 Like

We wrote a web ui for video encoding/decoding machines. People tend to want real time status updates so we originally polled every 250ms or so. I changed it to websockets and one of our clients couldn’t connect anymore. It’s a b2b situation with proxies and tunnels in between. After looking into it, apparently off the shelf proxy solutions tend to have websockets disabled by default. Bigger, firewalled companies will also disable them because they can eat up resources on the proxy. Most, if not all, libraries will put in some sort of fallback and do long polling or something similar if ws doesn’t connect.

We use the Socket.IO library (in our React.js front end, and a Java equivalent in our Clojure back end) and it automatically falls back to long polling if WS connections cannot be made. We track the numbers via New Relic and it looks like maybe 5% of all our customers worldwide are falling back to long polling. We do not attempt to track why WS don’t work.

1 Like

Haven’t used it but my understanding is that the only JavaScript is an tiny websocket client that ships with the framework and knows how to render DOM updates which are sent by the server.

All of the application logic including calculating the DOM changes is written in Elixir and running on the server.

Just found the beginnings of a Liveview like library for Clojure!
I think something like this will be huge, and Loom will be a perfect match for it. See the video:


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.