Cluster-wide tracking of who is connected where.
Backed by Phoenix.Presence, so entries are tied to process liveness and
replicated between nodes by CRDT: a node that dies takes its entries with it,
with no sweeper to notice. That is the property node-local ETS and database
flags both lack.
Used for signaling room membership and lobby spectators. Not for anything queried in SQL — presence lives in memory and cannot be joined against a table — and not for anything durable, since a full cluster restart empties it.
During a netsplit each side sees only its own members until they heal.
Summary
Functions
Callback implementation for Phoenix.Presence.fetch/2.
Callback implementation for Phoenix.Presence.get_by_key/2.
Whether the calling process holds this user's only tracked socket.
Callback implementation for Phoenix.Presence.list/1.
Callback implementation for Phoenix.Presence.track/3.
Callback implementation for Phoenix.Presence.track/4.
Callback implementation for Phoenix.Presence.untrack/2.
Callback implementation for Phoenix.Presence.untrack/3.
Callback implementation for Phoenix.Presence.update/3.
Callback implementation for Phoenix.Presence.update/4.
Number of topics connected users are spread over.
Topic this user is tracked on.
Functions
Callback implementation for Phoenix.Presence.fetch/2.
Callback implementation for Phoenix.Presence.get_by_key/2.
@spec last_socket?(Ecto.UUID.t()) :: boolean()
Whether the calling process holds this user's only tracked socket.
Cluster-wide, unlike the per-node registry count it replaces.
Callback implementation for Phoenix.Presence.list/1.
Callback implementation for Phoenix.Presence.track/3.
Callback implementation for Phoenix.Presence.track/4.
Callback implementation for Phoenix.Presence.untrack/2.
Callback implementation for Phoenix.Presence.untrack/3.
Callback implementation for Phoenix.Presence.update/3.
Callback implementation for Phoenix.Presence.update/4.
@spec users_buckets() :: pos_integer()
Number of topics connected users are spread over.
@spec users_topic(Ecto.UUID.t()) :: String.t()
Topic this user is tracked on.