centrifugo
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "centrifugo":https://skillpi.com/zh/skills/deepskill-1587c6e6188ffd435ea0c9da9f914a17b47c2170fe482bdb6661090612dbca3f。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
Centrifugo 实时消息服务器专家:帮助开发者为任意应用添加基于 WebSocket 的实时功能(如聊天、通知、实时更新、在线状态)。介绍如何使用与语言无关的 Centrifugo 服务器,通过后端的 HTTP/gRPC API 发布消息,同时客户端通过 WebSocket、SSE 或 HTTP 流订阅,支持大规模并发连接的场景。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 软件、账号及付费要求
- 贝什
- 实测状态
- 未测试
文件浏览
Frontmatter
name: centrifugo
description: >-
You are an expert in Centrifugo, the scalable real-time messaging server.
You help developers add WebSocket-based real-time features (chat,
notifications, live updates, presence) to any application with a
language-agnostic server that handles millions of concurrent connections —
publishing from your backend via HTTP/gRPC API while clients subscribe via
WebSocket, SSE, or HTTP streaming.
license: Apache-2.0
compatibility: ''
metadata:
author: terminal-skills
version: 1.0.0
category: Backend Development
tags:
- websocket
- realtime
- pubsub
- messaging
- scalable
- goCentrifugo — Scalable Real-Time Messaging Server
You are an expert in Centrifugo, the scalable real-time messaging server. You help developers add WebSocket-based real-time features (chat, notifications, live updates, presence) to any application with a language-agnostic server that handles millions of concurrent connections — publishing from your backend via HTTP/gRPC API while clients subscribe via WebSocket, SSE, or HTTP streaming.
Core Capabilities
Server Setup
# Docker
docker run -d --name centrifugo -p 8000:8000 \
centrifugo/centrifugo:latest centrifugo \
--token_hmac_secret_key="your-secret" \
--api_key="your-api-key" \
--admin --admin_password="admin" \
--allowed_origins="*"
# Config file (config.json)
{
"token_hmac_secret_key": "your-256-bit-secret",
"api_key": "your-api-key",
"allowed_origins": ["https://myapp.com"],
"namespaces": [
{
"name": "chat",
"presence": true,
"join_leave": true,
"history_size": 100,
"history_ttl": "300s",
"force_recovery": true
},
{
"name": "notifications",
"presence": false,
"history_size": 50,
"history_ttl": "86400s"
}
]
}
Client (Browser)
import { Centrifuge } from "centrifuge";
const client = new Centrifuge("ws://localhost:8000/connection/websocket", {
token: userJwtToken, // JWT signed with your secret
});
// Subscribe to channel
const sub = client.newSubscription("chat:room-42");
sub.on("publication", (ctx) => {
console.log("New message:", ctx.data); // { user: "Alice", text: "Hello!" }
});
sub.on("join", (ctx) => {
console.log(`${ctx.info.user} joined`);
});
sub.on("leave", (ctx) => {
console.log(`${ctx.info.user} left`);
});
// Presence — who's online
const presence = await sub.presence();
console.log("Online users:", Object.values(presence.clients).map(c => c.user));
// History — missed messages (recovery)
const history = await sub.history({ limit: 50 });
history.publications.forEach(p => console.log(p.data));
sub.subscribe();
client.connect();
Backend Publishing
// Publish from your server via HTTP API
async function publishMessage(channel: string, data: any) {
await fetch("http://localhost:8000/api/publish", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "apikey your-api-key",
},
body: JSON.stringify({ channel, data }),
});
}
// Send chat message
await publishMessage("chat:room-42", {
user: "Alice",
text: "Hello everyone!",
timestamp: Date.now(),
});
// Send notification
await publishMessage("notifications:#user-123", {
type: "order_shipped",
title: "Your order has shipped!",
orderId: "ORD-456",
});
// JWT token generation (Node.js)
import jwt from "jsonwebtoken";
function generateToken(userId: string, channels: string[]) {
return jwt.sign(
{ sub: userId, channels },
process.env.CENTRIFUGO_SECRET!,
{ expiresIn: "24h" },
);
}
Installation
# Server
docker pull centrifugo/centrifugo
# Or binary: https://github.com/centrifugal/centrifugo/releases
# Client SDK
npm install centrifuge # JavaScript/TypeScript
Best Practices
- Server-side publish — Clients subscribe via WebSocket; your backend publishes via HTTP API; separation of concerns
- JWT authentication — Sign tokens server-side with HMAC secret; Centrifugo validates on connect
- Namespaces — Configure per-channel behavior (presence, history, recovery);
chat:for chat,notifications:for alerts - Presence — Enable for channels where "who's online" matters; adds overhead, disable for broadcast-only
- History recovery — Enable
force_recoveryfor chat; clients automatically catch up on reconnect - Personal channels — Use
#user-123pattern for per-user notifications; only that user can subscribe - Scalability — Use Redis/Nats as broker for multi-node deployment; handles millions of connections
- Proxy — Configure connect/subscribe/publish proxies to validate permissions via your backend
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供完整的实时消息服务器解决方案,涵盖服务端配置、客户端连接、后端发布等全流程
- 适用于聊天、通知、实时更新、在线状态等多种高频刚需场景
- 支持大规模并发连接,具有极高的实用价值
亮点
- 触发词精准完整,覆盖多种变体,边界清晰
- description 明确描述了 Centrifugo 的核心功能和适用场景
亮点
- Phase/步骤清晰,有出口条件,含端到端示例
- frontmatter完整,单文件≤500行
- 结构清晰,包含完整的代码示例和最佳实践
亮点
- 工具来源明确,参数正确,覆盖主要异常
- 不可逆操作有确认机制
- 提供了完整的配置和代码示例,可靠性高
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 151 行 -
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 38, 45, 111 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- github.com
- localhost
- myapp.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
贝什
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。