Live_state - a "LiveView like" experience for applications that aren't served by Elixir

live_state is an elixir library and companion javascript library to give developers a “LiveView like” experience for applications that aren’t served by Elixir. In a nutshell, it give you a easy way to build Phoenix Channels that manage state for a client application. Clients then dispatch events, which are sent to the server to be handled, and receive updates from the server any time application state changes.

The latest versions, 0.6.2 of live_state adds:

  • Better documentation of the json_patch config setting which sets state updates as json patches rather than sending the entire state
  • A set of test helpers
  • Fixes a bug with state version numbers incrementing forever

The client, phx-live-state version 0.10.1, adds:

  • A liveStateProperty decorator to update a property from live state
  • The ability to have a property value be specified as a json pointer

Blog posts, examples, and conference talk videos are linked from the repo. Also, I’ll be training and talking about it in a few days at ElixirConf 2023


New version of LiveState just released: 0.8.1. This version changes the default for state update messages to be json_patch, along with fixing several bugs with the way json patches were created. Additionally, a message_builder option allows you take control of the way new state and updated state messages are created.

1 Like