Encodes and decodes awareness (presence) updates in the y-protocols format.
An update starts with its entry count as a varuint. Each entry contains a
client id and clock as varuints, then a length-prefixed JSON state;
"null" removes the client's state.
A host can use decode/1 to check the awareness messages its clients
send, and encode/1 to build an update from the entries it accepts. The
README's "Authorizing client awareness" section shows how. To publish and
maintain awareness for a server-side participant, use Slap.Yjs.Presence.
Summary
Functions
Decodes an awareness update into entries. A removal has a nil state.
Returns {:error, :invalid} for malformed updates.
Encodes entries into an awareness update.
Types
@type entry() :: {client_id :: non_neg_integer(), clock :: non_neg_integer(), state :: term()}
Functions
Decodes an awareness update into entries. A removal has a nil state.
Returns {:error, :invalid} for malformed updates.
A complete awareness message is byte 1 followed by a framed update. This function accepts only the unframed update.
Encodes entries into an awareness update.