pusher
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "pusher":https://skillpi.com/zh/skills/deepskill-1b9997f6e2305564903767b7c7c5af0ff5b7631e70ed86987717ddc030d1fbc0。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
Pusher Channels 专家:指导使用托管的实时消息平台(发布/订阅频道、Presence 频道、私有频道、客户端事件、Webhook 与批量触发器)为应用添加实时功能,如通知、仪表盘、聊天与协作,无需管理 WebSocket 基础设施。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 实测状态
- 未测试
文件浏览
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
- presencePusher — 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
- Channel naming — Public:
orders; Private:private-user-42; Presence:presence-room-5 - Private channels — Use for user-specific data; server must authorize via auth endpoint
- Presence for online status — Use presence channels to track who's online; includes user info
- Batch triggers — Use
triggerBatch()for multiple events; single API call, reduced latency - Client events — Enable for peer-to-peer (typing indicators, cursor position); no server roundtrip
- Webhooks — Configure webhooks for channel_occupied/vacated events; track active channels server-side
- Max payload 10KB — Keep event data small; send IDs and fetch details client-side if needed
- Fallback — Pusher auto-falls back from WebSocket to HTTP streaming/polling for restrictive networks
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供完整的 Pusher Channels 实时通信解决方案
- 覆盖服务端触发、客户端订阅、认证等核心功能
- 包含实际项目可用的代码示例和最佳实践
亮点
- 触发描述完整覆盖 pub/sub、presence、private channels 等核心能力
- 明确区分不同频道类型的使用场景
- 边界清晰,无歧义
亮点
- 文档结构清晰,分模块组织内容
- 包含完整的端到端代码示例
- frontmatter 元数据完整规范
亮点
- 工具来源明确,参数配置正确
- 包含权限验证和异常处理逻辑
- 提供批量触发等高级功能的使用指导
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 142, 143 行
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。