pusher
БесплатноБез исполняемых скриптовНе проверенPusher Channels is a hosted real-time messaging service: your server triggers events over HTTP and browsers receive them over WebSockets, with no socket…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Pusher
Overview
Pusher Channels is publish/subscribe over WebSockets. The server SDK (pusher, 5.x) publishes events through Pusher's HTTP API; the browser library (pusher-js, 8.x) subscribes to channels and falls back to HTTP streaming or polling on restrictive networks. Channel type is decided by the name prefix: no prefix is public, private- needs server authorization, presence- needs authorization plus user identity, private-encrypted- adds end-to-end encryption. The app id, key, secret and cluster come from the Channels app in the Pusher dashboard; the secret never leaves the server.
Instructions
- Install:
npm install pusheron the server,npm install pusher-jsin the client. - Create one server instance.
triggerandtriggerBatchreturn promises, soawaitthem and catchPusher.RequestError. - Trigger limits: event data at most 10 KB, one
triggerto at most 100 channels,triggerBatchat most 10 events, channel names at most 164 characters including theprivate-/presence-prefix (letters, digits and_ - = @ , . ;). - Authorize private and presence channels with
pusher.authorizeChannel(socketId, channelName, presenceData?). pusher-js POSTssocket_idandchannel_nameas form-encoded fields tochannelAuthorization.endpoint(default/pusher/auth), so the server needsexpress.urlencoded(). Always check that the logged-in user may join that channel before signing. - In the client set
channelAuthorization: { endpoint: "/api/pusher/auth" }. The oldauthEndpointoption is the pre-v7 name; use the new one. - Client events (typing, cursors) must be enabled in the app settings, only work on private and presence channels, and event names must start with
client-. - To exclude the sender from receiving its own server event, pass
{ socket_id }as the fourth argument oftrigger. - Verify webhooks (channel_occupied, channel_vacated, member_added, member_removed) with
pusher.webhook({ headers, rawBody }).isValid(); use the raw request body, not parsed JSON.
Examples
Server: trigger, batch and channel auth (Express)
import express from "express";
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: process.env.PUSHER_CLUSTER ?? "eu",
useTLS: true,
});
const app = express();
app.use(express.urlencoded({ extended: false }));
// "Notify the warehouse dashboard about order 8841"
await pusher.trigger("orders", "new-order", { id: "ord-8841", total: 99.99 });
await pusher.triggerBatch([
{ channel: "private-user-42", name: "notification", data: { message: "Invoice paid" } },
{ channel: "dashboard", name: "metric-update", data: { activeUsers: 1234 } },
]);
app.post("/api/pusher/auth", (req, res) => {
const { socket_id, channel_name } = req.body;
const user = req.user; // set by your session middleware
if (!user || !userCanAccessChannel(user, channel_name)) {
return res.status(403).json({ error: "Forbidden" });
}
if (channel_name.startsWith("presence-")) {
return res.json(
pusher.authorizeChannel(socket_id, channel_name, {
user_id: String(user.id),
user_info: { name: user.name },
})
);
}
res.json(pusher.authorizeChannel(socket_id, channel_name));
});
Client: live metric and presence list (React)
import Pusher from "pusher-js";
import { useEffect, useState } from "react";
const pusher = new Pusher(process.env.NEXT_PUBLIC_PUSHER_KEY!, {
cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER!,
channelAuthorization: { endpoint: "/api/pusher/auth", transport: "ajax" },
});
export function ActiveUsers() {
const [count, setCount] = useState<number | null>(null);
useEffect(() => {
const channel = pusher.subscribe("dashboard");
const onMetric = (p: { activeUsers: number }) => setCount(p.activeUsers);
channel.bind("metric-update", onMetric);
return () => {
channel.unbind("metric-update", onMetric);
pusher.unsubscribe("dashboard");
};
}, []);
return <div>Active users: {count ?? "..."}</div>;
}
type Member = { id: string; info: { name: string } };
export function OnlineUsers({ roomId }: { roomId: string }) {
const [members, setMembers] = useState<Member[]>([]);
useEffect(() => {
const name = `presence-room-${roomId}`;
const channel = pusher.subscribe(name);
channel.bind("pusher:subscription_succeeded", (m: any) => {
const list: Member[] = [];
m.each((member: Member) => list.push(member));
setMembers(list);
});
channel.bind("pusher:member_added", (m: Member) => setMembers((prev) => [...prev, m]));
channel.bind("pusher:member_removed", (m: Member) =>
setMembers((prev) => prev.filter((p) => p.id !== m.id))
);
return () => pusher.unsubscribe(name);
}, [roomId]);
return <ul>{members.map((m) => <li key={m.id}>{m.info.name}</li>)}</ul>;
}
Result:
Установить pusher в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pusher?
Pusher Channels is a hosted real-time messaging service: your server triggers events over HTTP and browsers receive them over WebSockets, with no socket infrastructure to run. Use this skill when a user wants to add live notifications, dashboards, chat, typing indicators or online-presence lists with pusher / pusher-js, authorize private and presence channels, send batch triggers, or verify Pusher webhooks.
Как установить скилл pusher?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pusher запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic