brazier/presence/sync
Types
One tracked entry’s meta, from any node.
pub type Meta(meta) {
Meta(
value: meta,
ref: String,
ref_prev: option.Option(String),
node: String,
)
}
Constructors
-
Meta( value: meta, ref: String, ref_prev: option.Option(String), node: String, )
Values
pub fn merge(
entries: List(Entry(meta)),
diff: Diff(meta),
) -> List(Entry(meta))
Apply diff to entries (Phoenix.Presence’s syncDiff): joins add
the metas whose refs are not there yet, then leaves remove the metas
with their refs, and keys left without metas are dropped. Applying a
diff twice changes nothing more. The result is ordered by key, like
presence.list.
OnlineChanged(diff) ->
Model(..model, online: sync.merge(model.online, diff))