centrifugo

Centrifugo realtime messaging server expert: helps developers add WebSocket-based realtime features (chat, notifications, live updates, presence) to any application. Explains using the language-agnostic Centrifugo server to handle large numbers of concurrent connections, publishing messages from the backend via HTTP/gRPC APIs while clients subscribe over WebSocket, SSE, or HTTP streaming.

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 "centrifugo" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-1587c6e6188ffd435ea0c9da9f914a17b47c2170fe482bdb6661090612dbca3f. 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

Centrifugo realtime messaging server expert: helps developers add WebSocket-based realtime features (chat, notifications, live updates, presence) to any application. Explains using the language-agnostic Centrifugo server to handle large numbers of concurrent connections, publishing messages from the backend via HTTP/gRPC APIs while clients subscribe over WebSocket, SSE, or HTTP streaming.

0 Downloads

Introduction source: third_party · TerminalSkills · 1.0.0 Reference

SkillPi interpretation

Software, accounts and paid services
```bash
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
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
    - go

Centrifugo — 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

  1. Server-side publish — Clients subscribe via WebSocket; your backend publishes via HTTP API; separation of concerns
  2. JWT authentication — Sign tokens server-side with HMAC secret; Centrifugo validates on connect
  3. Namespaces — Configure per-channel behavior (presence, history, recovery); chat: for chat, notifications: for alerts
  4. Presence — Enable for channels where "who's online" matters; adds overhead, disable for broadcast-only
  5. History recovery — Enable force_recovery for chat; clients automatically catch up on reconnect
  6. Personal channels — Use #user-123 pattern for per-user notifications; only that user can subscribe
  7. Scalability — Use Redis/Nats as broker for multi-node deployment; handles millions of connections
  8. Proxy — Configure connect/subscribe/publish proxies to validate permissions via your backend

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 Value95/100

Highlights

  • 提供完整的实时消息服务器解决方案,涵盖服务端配置、客户端连接、后端发布等全流程
  • 适用于聊天、通知、实时更新、在线状态等多种高频刚需场景
  • 支持大规模并发连接,具有极高的实用价值
Trigger Precision90/100

Highlights

  • 触发词精准完整,覆盖多种变体,边界清晰
  • description 明确描述了 Centrifugo 的核心功能和适用场景
Structure and Standards90/100

Highlights

  • Phase/步骤清晰,有出口条件,含端到端示例
  • frontmatter完整,单文件≤500行
  • 结构清晰,包含完整的代码示例和最佳实践
Execution Reliability90/100

Highlights

  • 工具来源明确,参数正确,覆盖主要异常
  • 不可逆操作有确认机制
  • 提供了完整的配置和代码示例,可靠性高
Evidence Verifiability (mean of the first four)91/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 151
  • Accounts, secrets or authorization

    Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.

    Mentioned in main document · lines 38, 45, 111
Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • github.com
  • localhost
  • myapp.com

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.

```bash

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