About pubnub-presence
pubnub-presence is a specialist skill for developers building PubNub real-time applications. It covers presence event orchestration, disconnect handling, and multi-device patterns, while directing API details to PubNub MCP or official documentation.
Key features
- 01Guidance for enabling Presence and channel rules
- 02Fetch initial occupancy before processing live events
- 03Distinguish leave, timeout, and disconnect states
- 04References for heartbeat, timeout, and multi-device design
- 05Manage event volume on large channels
Use cases
- 01Show channel members' online status
- 02Combine initial occupancy with join and leave events
- 03Handle disconnects and multi-device presence
- 04Verify presence event flow in staging
MCP support
The skill directs users to PubNub MCP tools for SDK documentation and staging event-flow verification. It requires PubNub MCP for API shapes, limits, configuration values, or live operations.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ pubnub/ skills --skill pubnub-presenceAfter installing, type/pubnub-presencein Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
tile.jsonevals/instructions.jsonsummary_infeasible.jsonsummary.jsonevals/scenario-0/capability.txtcriteria.jsontask.mdevals/scenario-1/capability.txtcriteria.jsontask.mdevals/scenario-2/capability.txtcriteria.jsontask.mdevals/scenario-3/capability.txtcriteria.jsontask.mdevals/scenario-4/capability.txtcriteria.jsontask.mdreferences/dropped-connections.mdmulti-device-sync.mdpresence-patterns.mdpresence-setup.mdDetails
From the project READMEPubNub Presence Specialist
Precedence: PubNub MCP tools and pubnub.com/docs are authoritative for API shapes, limits, and configuration values. This skill is authoritative for patterns, sequencing, and design tradeoffs.
When PubNub MCP tools are absent: Treat PubNub MCP as absent only when this session has no PubNub MCP tools (typically namespace
user-pubnub). Do not ask the user to check MCP if those tools are already listed. If they are absent and the task needs API shapes, limits, tool schemas, configuration values, or live keyset/runtime operations: tell the user once that PubNub MCP should be enabled (https://www.pubnub.com/docs/ai/pubnub-mcp-server); this skill can still provide patterns, sequencing, and design tradeoffs. Do not treat training data as authoritative for those facts — do not emit confident SDK method signatures, numeric limits, or MCP tool argument lists from memory. Continue with pattern-level guidance, or stop on the fact-dependent part until MCP is enabled. Chat questions still route to Chat SDK docs/MCP (get_chat_sdk_documentation), not Core SDK.
Core Workflow
- Enable & scope — Presence add-on + Presence Management channel rules (presence-setup.md).
- Subscribe with presence — retrieve API from
get_sdk_documentation. - Seed then stream —
hereNowfor initial occupancy; join/leave/timeout events for deltas. - Tune heartbeat/timeout — trade latency vs event volume (presence-setup.md).
- Handle disconnects — dropped-connections.md + backoff.
- Multi-device — multi-device-sync.md.
Reference Guide
| Reference | Purpose |
|---|---|
| presence-setup.md | Portal prerequisites, heartbeat tuning |
| presence-patterns.md | Scalable presence patterns |
| dropped-connections.md | Status categories vs presence leave |
| multi-device-sync.md | userId design for multiple devices |
Event orchestration
| Phase | Action |
|---|---|
| Initial | After connect, fetch occupancy (hereNow) before trusting empty UI |
| Live | Apply join/leave/timeout/state-change deltas — retrieve event shapes from SDK docs |
| High occupancy | Expect interval events; batch UI updates |
| Leave UX | Distinguish explicit leave vs timeout vs disconnect (dropped-connections.md) |
Constraints
- Channel must be allowed in Presence Management rules.
- Persistent
userIdrequired. - Presence is per-connection — see multi-device-sync.md.
- Mind event volume on large channels — cost & payload hygiene.
MCP Tools
get_sdk_documentation— presence APIs, hereNow, statesubscribe_and_receive_pubnub_messages— verify event flow in staging
See Also
- pubnub-app-developer — pub/sub primitives
- pubnub-app-context — persistent user metadata alongside presence
- pubnub-observability — presence flapping runbook
- pubnub-scale — large-event occupancy