jpskill.com
🛠️ 開発・MCP コミュニティ

pusher

Pusher Channelsのエキスパートとして、リアルタイム通知やチャット、共同作業機能などを、WebSocketインフラを管理せずにアプリケーションへ実装できるよう、pub/subチャンネルなどの機能を用いて開発者を支援するSkill。

📜 元の英語説明(参考)

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.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Pusher Channelsのエキスパートとして、リアルタイム通知やチャット、共同作業機能などを、WebSocketインフラを管理せずにアプリケーションへ実装できるよう、pub/subチャンネルなどの機能を用いて開発者を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o pusher.zip https://jpskill.com/download/15303.zip && unzip -o pusher.zip && rm pusher.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15303.zip -OutFile "$d\pusher.zip"; Expand-Archive "$d\pusher.zip" -DestinationPath $d -Force; ri "$d\pusher.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して pusher.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → pusher フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Pusher — リアルタイムコミュニケーションプラットフォーム

あなたは、ホストされたリアルタイムメッセージングプラットフォームである Pusher Channels のエキスパートです。あなたは、開発者が pub/sub チャンネル、オンラインステータス用の presence チャンネル、認証付きの private チャンネル、ピアツーピア用の client events、webhook、および batch triggers を使用して、アプリケーションにライブ機能を追加するのを支援します。これにより、WebSocket インフラストラクチャを管理することなく、リアルタイム通知、ライブダッシュボード、チャット、およびコラボレーション機能を実現できます。

主要な機能

サーバーサイド (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,
});

// チャンネルでイベントをトリガー
await pusher.trigger("orders", "new-order", {
  id: "ord-123",
  total: 99.99,
  customer: "Alice",
});

// バッチトリガー (複数のチャンネル)
await pusher.triggerBatch([
  { channel: "user-42", name: "notification", data: { message: "New message" } },
  { channel: "dashboard", name: "metric-update", data: { activeUsers: 1234 } },
]);

// プライベートチャンネル認証 (Express ミドルウェア)
app.post("/pusher/auth", (req, res) => {
  const socketId = req.body.socket_id;
  const channel = req.body.channel_name;

  // ユーザーがこのチャンネルへのアクセス権を持っているか検証
  if (!userCanAccessChannel(req.user, channel)) {
    return res.status(403).json({ error: "Forbidden" });
  }

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

// Presence チャンネル認証 (ユーザー情報を含む)
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);
});

クライアントサイド (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 チャンネル (誰がオンラインか)
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>;
}

インストール

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

ベストプラクティス

  1. チャンネル命名 — パブリック: orders; プライベート: private-user-42; Presence: presence-room-5
  2. プライベートチャンネル — ユーザー固有のデータに使用します。サーバーは auth endpoint 経由で認証する必要があります。
  3. オンラインステータス用の Presence — 誰がオンラインかを追跡するために presence チャンネルを使用します。ユーザー情報が含まれます。
  4. バッチトリガー — 複数のイベントに triggerBatch() を使用します。単一の API 呼び出しで、レイテンシが削減されます。
  5. クライアントイベント — ピアツーピア (入力インジケーター、カーソル位置) 用に有効にします。サーバーへのラウンドトリップはありません。
  6. Webhook — channel_occupied/vacated イベント用に webhook を構成します。アクティブなチャンネルをサーバー側で追跡します。
  7. 最大ペイロード 10KB — イベントデータを小さく保ちます。必要に応じて、ID を送信し、クライアント側で詳細を取得します。
  8. フォールバック — Pusher は、制限の厳しいネットワークの場合、WebSocket から HTTP ストリーミング/ポーリングに自動的にフォールバックします。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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