ChannelsPresence channels

Presence channels

Channels prefixed with presence- are private channels with the addition of a member roster. Every subscriber knows who else is on the channel and gets member_added / member_removed events.

When to use

  • Multiplayer games, collaborative editors
  • “Who’s online” lists
  • Live document editing (cursor sharing)
  • Sales-rep “who’s currently viewing this account” indicators

Auth

Same flow as private channels, but your auth endpoint also returns a channel_data object with the user id and any custom info you want to share with other members.

// PHP example
$auth = $pusher->authorizePresenceChannel(
    $_POST['channel_name'],
    $_POST['socket_id'],
    (string) $userId,
    [
        'name'   => $user->name,
        'avatar' => $user->avatar_url,
    ],
);

Client

const channel = pusher.subscribe('presence-room-42');
 
// Initial members snapshot
channel.bind('pusher:subscription_succeeded', (members) => {
  console.log(`Initial member count: ${members.count}`);
  members.each((m) => console.log(m.id, m.info));
});
 
// Live join / leave
channel.bind('pusher:member_added', (m) => console.log('joined', m.id, m.info));
channel.bind('pusher:member_removed', (m) => console.log('left', m.id));

Listing members from your server

const members = await pusher.get({ path: '/channels/presence-room-42/users' });
// { users: [{ id: '42' }, { id: '101' }] }

Or from the Mawjly dashboard: Channels tab → click any presence- channel → see the live member roster.

Limits

  • Max members per presence channel: 100 (Free) / 500 (Pro) / 1,000+ (Business)
  • Max member info JSON size: 10 KB