Offline Support for LiveView Features

what you have in mind is something like lumen being downloaded and run on client side, and then connecting to other “nodes” running on other clients? sort of peer to peer network of beam nodes? decentralized “backend” apps? :slight_smile:

talking specifically about liveview, I sounds to me it’s going in the exact opposite direction than you are wishing for - you want thicker client, liveview promises to have some of the cool features of thick clients with actually super thin (almost none) client, doesn’t it?

1 Like

You should think if you really need offline features or not. If you make LiveView WebSocket reconnects robust meaning important state that can’t be restored from database etc. is restored from client/browser state experience should still be quite good. If users need to able work while their connection is offline then you need to use some other client tech.Making app work offline and sync changes back to server when it’s online again is another level of work. Think hard what your actual requirementa are.

You should be able to test LiveSocket reconnects by liveSocket.disconnect() and then liveSocket.connect() from browser console.

So having been around for several discussions on Lumen (I’ve worked on the site) I don’t think Erlang distribution is intended for client-server communication there.
For one thing Erlang distribution lets nodes run code on each other. Remote Code Execution as a service :slight_smile:

Lumen could, when ready, certainly let you write Elixir for your frontend or potentially re-use your server side logic on your client. I think that could be an addition to LiveView. I doubt it would be inside of LiveView.

There are serious challenges to overocme anytime you want to do good offline and good online. If/when Lumen ships it could be part of making that possible by writing only Elixir.

For now I’d look at what can be done using LiveView JS commands. I haven’t dug into it though.

2 Likes

Gleam compiles to JS as well. Haven’t tried it for anything yet.

Thank you all for your replies.

I have learnt much more than I anticipated.

2 Likes

Is this documented somewhere? I’d like to reference this if possible. :smiley: