pubnub-presence

Monitor join, leave, timeout, and state-change events on PubNub channels.

6|Updated May 26, 2026
One-click install
npx skills add https://github.com/pubnub/skills --skill pubnub-presence
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pubnub-presence
Source: https://github.com/pubnub/skills/tree/main/pubnub-presence
Command: npx skills add https://github.com/pubnub/skills --skill pubnub-presence

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Real-time presence tracking across PubNub channels enables reliable online/offline indicators, accurate occupancy counts, and robust connection state management across devices.

Core Features & Use Cases

  • Enable Presence in the Admin Portal to activate presence tracking for selected channels
  • Subscribe with presence to receive join, leave, timeout, and state-change events
  • Track occupancy using hereNow and event-driven updates for scalable UIs
  • Manage per-user presence state and synchronize multi-device sessions
  • Handle disconnects gracefully and support automatic reconnection
  • Use cases include chat rooms, collaboration spaces, gaming lobbies, and live dashboards

Quick Start

Subscribe to a channel with presence enabled and set up a presence listener to track events and fetch initial occupancy with hereNow.

Frequently Asked Questions about pubnub-presence

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I track real-time presence and occupancy counts in a PubNub channel?

Track real-time presence by subscribing to a channel with presence enabled, which generates join, leave, timeout, and state-change events to maintain accurate occupancy counts. You must first enable presence in the Admin Portal before subscribing to receive these events.

What is the best way to get the initial channel state and online users when using PubNub presence?

Use the hereNow function to query initial occupancy and retrieve the current online users before processing event-driven updates. This provides the baseline state so your UI can immediately display who is online when a session starts.

Can I synchronize per-user presence state across multiple devices with PubNub?

Yes, you can manage per-user presence state and synchronize multi-device sessions by listening for state-change events. This ensures consistent online/offline indicators and custom user states across all connected devices.

How does PubNub handle presence events when a client disconnects unexpectedly?

PubNub processes timeout events when clients disconnect unexpectedly, allowing you to handle disconnects gracefully and support automatic reconnection. This ensures occupancy counts remain accurate even during unstable network conditions.

Do I need to enable presence in the Admin Portal before subscribing to presence events?

Yes, you must enable presence in the PubNub Admin Portal to activate tracking for selected channels. After activation, you can subscribe with presence to start receiving join, leave, and state-change events.

What scenarios are best suited for using PubNub real-time presence tracking?

PubNub presence tracking is ideal for chat rooms, collaboration spaces, gaming lobbies, and live dashboards requiring reliable online/offline indicators. It provides event-driven updates that scale for real-time user interfaces.