centrifugo
FreeNo executable scriptsNot checkedCentrifugo is a self-hosted real-time messaging server: your backend publishes over an HTTP or gRPC API and browsers or mobile apps receive messages over…
by TerminalSkills★ 221 GitHub starsAbout this skill
Centrifugo — Scalable Real-Time Messaging Server
Overview
Centrifugo sits between your backend and your clients. The backend publishes to named channels through the server API (/api/publish, authenticated with an API key); clients connect with a JWT signed by your backend and subscribe to channels. Features: namespaces with per-channel options, presence, join/leave events, history with automatic recovery after reconnect, and Redis or NATS engines for several nodes. This skill targets Centrifugo v6 (6.9.7 checked, October 2026). v6 restructured the config: keys that were flat in v5 (token_hmac_secret_key, api_key, allowed_origins, namespaces) now live under client.token.hmac_secret_key, http_api.key, client.allowed_origins and channel.namespaces. SockJS and the Tarantool engine were removed. The official site offers a converter for v5 configs.
Instructions
1. Install and generate a config
# binary: download the release archive and verify it against centrifugo_<version>_checksums.txt
sha256sum -c --ignore-missing centrifugo_6.9.7_checksums.txt
./centrifugo genconfig -c config.json # writes random token key, API key, admin password
./centrifugo checkconfig -c config.json
./centrifugo -c config.json # listens on :8000
Docker alternative: docker run --rm -p 127.0.0.1:8000:8000 -v "$PWD/config.json:/centrifugo/config.json" centrifugo/centrifugo:v6 centrifugo --config=config.json.
2. Configure namespaces
A channel chat:room-42 takes its options from the namespace chat; channels without a namespace use channel.without_namespace. Almost every permission is off by default, so enable what the client needs.
{
"client": {
"token": { "hmac_secret_key": "set-via-CENTRIFUGO_CLIENT_TOKEN_HMAC_SECRET_KEY" },
"allowed_origins": ["https://shopfront.io"]
},
"http_api": { "key": "set-via-CENTRIFUGO_HTTP_API_KEY" },
"admin": { "enabled": true, "password": "from-env", "secret": "from-env" },
"channel": {
"namespaces": [
{
"name": "chat",
"presence": true, "join_leave": true,
"history_size": 100, "history_ttl": "300s", "force_recovery": true,
"allow_subscribe_for_client": true,
"allow_presence_for_subscriber": true,
"allow_history_for_subscriber": true
},
{
"name": "notifications",
"history_size": 50, "history_ttl": "24h",
"allow_user_limited_channels": true
}
]
}
}
Every key can also be an environment variable: CENTRIFUGO_CLIENT_TOKEN_HMAC_SECRET_KEY, CENTRIFUGO_HTTP_API_KEY, CENTRIFUGO_CHANNEL_NAMESPACES (a JSON array). Keep secrets in the environment, not in git.
3. Backend: issue tokens and publish
import jwt from "jsonwebtoken";
// connection token: `sub` is the user id; expire it and let the client refresh
export function connectionToken(userId: string) {
return jwt.sign({ sub: userId }, process.env.CENTRIFUGO_CLIENT_TOKEN_HMAC_SECRET_KEY!, { expiresIn: "1h" });
}
export async function publish(channel: string, data: unknown) {
const res = await fetch("http://localhost:8000/api/publish", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: `apikey ${process.env.CENTRIFUGO_HTTP_API_KEY}` },
body: JSON.stringify({ channel, data }),
});
const body = await res.json();
if (body.error) throw new Error(`centrifugo ${body.error.code}: ${body.error.message}`);
}
The API replies {"result":{"offset":1,"epoch":"..."}} on success and {"error":{"code":102,"message":"unknown channel"}} for a namespace that is not configured. Other useful methods: /api/history, /api/presence, /api/broadcast (one payload, many channels), /api/disconnect, /api/info. A quick token for testing: ./centrifugo gentoken -c config.json -u alice.
4. Browser client
import { Centrifuge } from "centrifuge"; // npm install centrifuge
const client = new Centrifuge("wss://rt.shopfront.io/connection/websocket", {
getToken: () => fetch("/api/realtime-token").then(r => r.text()), // called on connect and refresh
});
const sub = client.newSubscription("chat:room-42");
sub.on("publication", ctx => console.log(ctx.data)); // { user: "Alice", text: "Hello!" }
sub.on("join", ctx => console.log(`${ctx.info.user} joined`));
sub.subscribe();
client.connect();
const presence = await sub.presence(); // after subscribed
const history = await sub.history({ limit: 50 });
Personal channels use the # form: notifications:#user-123 can be subscribed only by the user whose sub is user-123, and only when the namespace sets allow_user_limited_channels.
Examples
Example 1: Live order notifications
User request: "Tell the customer in the browser when their order ships."
Enable the notifications namespace above, subscribe the page to notifications:#<userId>, and from the order service run `awai
Install centrifugo in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the centrifugo skill do?
Centrifugo is a self-hosted real-time messaging server: your backend publishes over an HTTP or gRPC API and browsers or mobile apps receive messages over WebSocket, SSE or HTTP streaming. Use when the user wants chat, live notifications, presence ("who is online"), message history with recovery, or any WebSocket pub/sub without writing a socket server.
How do I install the centrifugo skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the centrifugo skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
by Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
by Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
by Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
by Anthropic