LocalLiveView - a library for running Phoenix LiveView state in the browser, powered by Popcorn

Local LiveView is a library that runs LiveView code in the browser via Popcorn.

It lets you offload simple UI updates from the server, drastically reduce latency on poor networks, and avoid “WebSocket disconnected” issues. Many Phoenix Components and Live Components just work on the client with no changes. Local LiveView also provides mechanisms for client-server communication, which means you can easily integrate it with regular LiveView. Now it ships with documentation, guides, and even an Igniter-based installer.

More in the blog post.

18 Likes

Thank you very much!

LocalLiveView is an amazing library, loved it. Also, I have few questions about serde-ing:

  • What is the format of the data that go back and forth between Phoenix LiveView and LocalLiveView? (JSON or some kind of a binary format such as MessagePack/CBOR)
  • Can I implement MessagePack/CBOR just like this post?
2 Likes

Thanks for the kind words :wink: Currently, it’s Erlang Term Format for passing assigns from the server to client and JSON for events (client → server). There’s no API for custom serialization, contributions are welcome :smiley: There are also other optimisation opportunities, such as sending a diff of assigns instead of all assigns each time.

3 Likes