pusher

Pusher Channels expert: guide using the hosted real-time messaging platform (publish/subscribe channels, Presence channels, private channels, client events, webhooks, and batch triggers) to add real-time features—notifications, dashboards, chat, and collaboration—without managing WebSocket infrastructure.

Last repository push
GitHub Stars
219
Forks
38
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "pusher" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-1b9997f6e2305564903767b7c7c5af0ff5b7631e70ed86987717ddc030d1fbc0. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Pusher Channels expert: guide using the hosted real-time messaging platform (publish/subscribe channels, Presence channels, private channels, client events, webhooks, and batch triggers) to add real-time features—notifications, dashboards, chat, and collaboration—without managing WebSocket infrastructure.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: pusher
description: >-
  You are an expert in Pusher Channels, the hosted real-time messaging
  platform. You help developers add live features to applications using
  pub/sub channels, presence channels for online status, private channels with
  auth, client events for peer-to-peer, webhooks, and batch triggers —
  enabling real-time notifications, live dashboards, chat, and collaborative
  features without managing WebSocket infrastructure.
license: Apache-2.0
compatibility: ''
metadata:
  author: terminal-skills
  version: 1.0.0
  category: Backend Development
  tags:
    - realtime
    - websocket
    - channels
    - pub-sub
    - notifications
    - presence

Pusher — Real-Time Communication Platform

You are an expert in Pusher Channels, the hosted real-time messaging platform. You help developers add live features to applications using pub/sub channels, presence channels for online status, private channels with auth, client events for peer-to-peer, webhooks, and batch triggers — enabling real-time notifications, live dashboards, chat, and collaborative features without managing WebSocket infrastructure.

Core Capabilities

Server-Side (Node.js)

import Pusher from "pusher";

const pusher = new Pusher({
  appId: process.env.PUSHER_APP_ID!,
  key: process.env.PUSHER_KEY!,
  secret: process.env.PUSHER_SECRET!,
  cluster: "us2",
  useTLS: true,
});

// Trigger event on a channel
await pusher.trigger("orders", "new-order", {
  id: "ord-123",
  total: 99.99,
  customer: "Alice",
});

// Batch trigger (multiple channels)
await pusher.triggerBatch([
  { channel: "user-42", name: "notification", data: { message: "New message" } },
  { channel: "dashboard", name: "metric-update", data: { activeUsers: 1234 } },
]);

// Private channel auth (Express middleware)
app.post("/pusher/auth", (req, res) => {
  const socketId = req.body.socket_id;
  const channel = req.body.channel_name;

  // Verify user has access to this channel
  if (!userCanAccessChannel(req.user, channel)) {
    return res.status(403).json({ error: "Forbidden" });
  }

  const auth = pusher.authorizeChannel(socketId, channel);
  res.json(auth);
});

// Presence channel auth (includes user info)
app.post("/pusher/auth", (req, res) => {
  const socketId = req.body.socket_id;
  const channel = req.body.channel_name;

  if (channel.startsWith("presence-")) {
    const auth = pusher.authorizeChannel(socketId, channel, {
      user_id: req.user.id,
      user_info: { name: req.user.name, avatar: req.user.avatar },
    });
    return res.json(auth);
  }

  const auth = pusher.authorizeChannel(socketId, channel);
  res.json(auth);
});

Client-Side (React)

import Pusher from "pusher-js";
import { useEffect, useState } from "react";

const pusher = new Pusher(process.env.NEXT_PUBLIC_PUSHER_KEY!, {
  cluster: "us2",
  authEndpoint: "/api/pusher/auth",
});

function useChannel<T>(channelName: string, eventName: string): T | null {
  const [data, setData] = useState<T | null>(null);

  useEffect(() => {
    const channel = pusher.subscribe(channelName);
    channel.bind(eventName, (payload: T) => setData(payload));
    return () => { pusher.unsubscribe(channelName); };
  }, [channelName, eventName]);

  return data;
}

function LiveDashboard() {
  const metric = useChannel<{ activeUsers: number }>("dashboard", "metric-update");
  return <div>Active Users: {metric?.activeUsers ?? "..."}</div>;
}

// Presence channel (who's online)
function OnlineUsers({ roomId }: { roomId: string }) {
  const [members, setMembers] = useState<any[]>([]);

  useEffect(() => {
    const channel = pusher.subscribe(`presence-room-${roomId}`);
    channel.bind("pusher:subscription_succeeded", (m: any) => {
      setMembers(Object.values(m.members));
    });
    channel.bind("pusher:member_added", (m: any) => {
      setMembers(prev => [...prev, m.info]);
    });
    channel.bind("pusher:member_removed", (m: any) => {
      setMembers(prev => prev.filter(p => p.id !== m.id));
    });
    return () => { pusher.unsubscribe(`presence-room-${roomId}`); };
  }, [roomId]);

  return <ul>{members.map(m => <li key={m.id}>{m.name}</li>)}</ul>;
}

Installation

npm install pusher                        # Server
npm install pusher-js                     # Client

Best Practices

  1. Channel naming — Public: orders; Private: private-user-42; Presence: presence-room-5
  2. Private channels — Use for user-specific data; server must authorize via auth endpoint
  3. Presence for online status — Use presence channels to track who's online; includes user info
  4. Batch triggers — Use triggerBatch() for multiple events; single API call, reduced latency
  5. Client events — Enable for peer-to-peer (typing indicators, cursor position); no server roundtrip
  6. Webhooks — Configure webhooks for channel_occupied/vacated events; track active channels server-side
  7. Max payload 10KB — Keep event data small; send IDs and fetch details client-side if needed
  8. Fallback — Pusher auto-falls back from WebSocket to HTTP streaming/polling for restrictive networks

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 提供完整的 Pusher Channels 实时通信解决方案
  • 覆盖服务端触发、客户端订阅、认证等核心功能
  • 包含实际项目可用的代码示例和最佳实践
Trigger Precision95/100

Highlights

  • 触发描述完整覆盖 pub/sub、presence、private channels 等核心能力
  • 明确区分不同频道类型的使用场景
  • 边界清晰,无歧义
Structure and Standards90/100

Highlights

  • 文档结构清晰,分模块组织内容
  • 包含完整的端到端代码示例
  • frontmatter 元数据完整规范
Execution Reliability85/100

Highlights

  • 工具来源明确,参数配置正确
  • 包含权限验证和异常处理逻辑
  • 提供批量触发等高级功能的使用指导
Evidence Verifiability (mean of the first four)89/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 142, 143

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.