top | item 45609026

(no title)

pythonaut_16 | 4 months ago

This is actually one of the huge tradeoffs and pitfalls of LiveView. Its websocket model is all or nothing.

For example I have a small side project using LiveView where users would typically pull their phone out, quickly record data, then put it away again. But due LiveView only working with a connected websocket they often have to wait ~1s for the socket to reconnect, and get an annoying error message while it does.

I'm sure there's more I could do to configure this but the default at least is terrible. I believe with Hotwire I wouldn't have this problem, my view would just work and then restore the websocket when it can.

I use Phoenix and LiveView for a lot but I wish we could get more of these rough edges polished up.

discuss

order

bartblast|4 months ago

(Disclosure: I'm building Hologram)

You might find Hologram interesting for this use case - it transpiles Elixir to JavaScript so your UI runs client-side. No persistent connection needed, so no reconnection delays or error messages. Still write in Elixir, still communicate with the server when needed.

It's early stage with some rough edges, but there are already Hologram apps in production: https://hologram.page

akarshc|4 months ago

that’s a really valid point. liveview’s websocket-first model can feel heavy for quick, intermittent interactions like mobile data entry. it shines when the user is continuously connected, but those short bursts do expose rough edges. hotwire’s approach of progressive enhancement and optimistic rendering handles these scenarios more gracefully since the view works independently of the connection. phoenix and liveview are still amazing, but improving these “short session” experiences would make it even stronger.