LiveState.MessageBuilder (live_state v0.8.2)

This is the default message builder for LiveState. It will send json_patch messages for state updates. The Elixir terms are compared using the JSONDiff library to create the JSON patch. Because JSONDiff is not aware of any impls of the JSON Encoder protocol, the patch may or may not match the JSON encoding in certain cases. Best effort has been made to handle common cases such ecto schemas and DateTime. To gain further control over this process, you may implement the LiveState.Encoder protocol which will allow you to define a pre-diff representation.

For a slower, but potentially more correct approach to the problem, there is a branch containing an alternate json diff implemenation in rust.

Link to this section Summary

Link to this section Functions

Link to this function

new_state_message(new_state, version, opts \\ [])

Link to this function

update_state_message(old_state, new_state, version, opts \\ [])