Core concepts
Presence and client counts
How Phoenix Presence surfaces member counts to subscribers and the SDK.
When a socket joins events:<topic>, the server tracks presence metadata for that topic.
What you will observe
- Phoenix pushes a
presence_statesnapshot after a successful join. - The JavaScript client emits a
topicPresenceevent when it decodes asystemenvelope withevent: "presence_change"for a subscribed topic. client.clientCount(topic)asks the channel for the current integer member count.
These mechanisms are intentionally small: you get occupancy signals without leaking unnecessary per-member data through the SDK unless you handle raw envelopes yourself.