Overview
Discover what makes Centrifugo powerful
Centrifugo is a high‑performance, language‑agnostic PUB/SUB server that delivers real‑time messages over multiple transports—WebSocket, HTTP‑streaming, Server‑Sent Events (SSE), gRPC, and the emerging WebTransport. Built in Go, it leverages a compact binary protocol that can be marshalled as JSON or Protobuf, and supports built‑in batching for low‑latency delivery. From a developer’s point of view, Centrifugo acts as a dedicated real‑time transport layer that can be dropped into any existing backend stack without invasive changes, enabling instant chat, live dashboards, multiplayer game state sync, or any event‑driven feature.
Core Engine
Transport Layer
Data Store & Scaling
Authentication & Authorization
Overview
Centrifugo is a high‑performance, language‑agnostic PUB/SUB server that delivers real‑time messages over multiple transports—WebSocket, HTTP‑streaming, Server‑Sent Events (SSE), gRPC, and the emerging WebTransport. Built in Go, it leverages a compact binary protocol that can be marshalled as JSON or Protobuf, and supports built‑in batching for low‑latency delivery. From a developer’s point of view, Centrifugo acts as a dedicated real‑time transport layer that can be dropped into any existing backend stack without invasive changes, enabling instant chat, live dashboards, multiplayer game state sync, or any event‑driven feature.
Architecture
- Core Engine: Go (1.20+), compiled to a single static binary, ensuring minimal runtime overhead and easy deployment across Linux, macOS, Windows, or container platforms.
- Transport Layer: Implements WebSocket RFC 6455, SSE (EventSource), HTTP‑streaming, gRPC/Protobuf streams, and WebTransport (experimental). The protocol is stateless per connection but preserves a session ID for reconnection and message recovery.
- Data Store & Scaling: Out‑of‑the‑box support for Redis (standalone, cluster, or any compatible store such as Valkey, KeyDB, DragonflyDB), NATS, and PostgreSQL/Kafka consumers for outbox/CDC patterns. Redis is used for pub/sub channel state, message history cache, and presence information; NATS can be swapped for a lightweight broker in micro‑service architectures.
- Authentication & Authorization: Two pluggable strategies—JWT validation directly in the client header, or a proxy‑style auth where Centrifugo forwards an HTTP request to your backend and interprets the response. This allows fine‑grained channel permissions, namespace scoping, and server‑side subscriptions that run on the Centrifugo node itself.
Core Capabilities
- Channel Subscription Model: Clients subscribe to arbitrary channel names; subscriptions can be client‑side (client decides) or server‑side (backend pushes subscription commands).
- Message History & Recovery: Hot history with configurable message retention (seconds to days). Upon reconnect, the client receives missed messages via delta compression using the Fossil algorithm, or immediate “latest” delivery in cache‑recovery mode.
- Presence & Metadata: Built‑in presence tracking with join/leave events, user metadata propagation, and channel namespace support for multi‑tenant isolation.
- RPC Over Real‑Time: Clients can invoke RPC calls that are routed to the backend over the same connection, enabling low‑latency control commands.
- Observability: Prometheus metrics (connections, message rates, latency), structured logs, and an embedded admin UI for live monitoring.
- Extensibility: Webhooks for connection events, custom authentication providers, and optional plugins (e.g., rate limiting, audit logging) can be wired into the Go codebase or via external services.
Deployment & Infrastructure
Centrifugo is a self‑hosted service that runs as a single binary; it ships with a Docker image (centrifugo/centrifugo:v6) and can be orchestrated via Kubernetes, Docker Compose, or plain VM. The binary is lightweight (≈30 MB) and stateless beyond its optional Redis or NATS integration, making it trivial to scale horizontally: simply launch more instances behind a load balancer and share the same backend store. The Go runtime’s efficient goroutine model allows millions of concurrent WebSocket connections on a single modern server (benchmark: 1 M WS + 30 M msgs/min). For production, a Redis cluster or NATS JetStream is recommended to avoid single‑point bottlenecks and provide persistence.
Integration & Extensibility
- SDKs: Official clients for JavaScript, TypeScript, Swift (iOS), Kotlin/Java (Android), and Go are available. SDKs expose a clean API for subscribing, publishing, RPC, and presence handling.
- HTTP/GRPC APIs: Backend services can publish or subscribe via simple HTTP endpoints (
/publish,/subscribe) or gRPC calls, allowing tight coupling with existing micro‑services. - Webhooks: Connection and disconnection events can be forwarded to arbitrary URLs, enabling audit logs or external analytics.
- Custom Auth: Implement a custom auth provider by embedding your own logic in the Go code or by hooking into the proxy‑style auth endpoint.
- Plugins: The server exposes hooks for middleware (e.g., rate limiting, compression) and can be extended with Go modules or external services.
Developer Experience
Centrifugo’s documentation is comprehensive, featuring a design overview, quickstart tutorials, and in‑depth API references. The codebase follows idiomatic Go practices, making it approachable for Go developers and straightforward to fork or contribute. The community is active on Telegram, Discord, and Twitter; issues are triaged quickly, and the project follows semantic versioning. The embedded admin UI gives developers instant visibility into channel activity without external tooling.
Use Cases
| Scenario | Why Centrifugo? |
|---|---|
| Live chat or messenger | Low‑latency WebSocket delivery, presence notifications, and server‑side subscription for moderation. |
| Real‑time dashboards | Delta compression reduces bandwidth; hot history ensures data continuity after reconnects. |
| **Mult |
Open SourceReady to get started?
Join the community and start self-hosting Centrifugo today
Related Apps in apis-services
Mastodon
Decentralized, real‑time social networking
Discourse
Open‑source community forum platform with real‑time chat and AI
Rocket.Chat
Secure, open‑source team communication platform
Novu
Unified notification platform for multi‑channel delivery
Mattermost
Secure, self‑hosted team collaboration with chat, voice, and AI
Jitsi Meet
Free, encrypted video conferencing for everyone
Weekly Views
Repository Health
Information
Explore More Apps
Zimbra Collaboration
Self-hosted other
nefarious
Auto‑download movies and TV shows via torrents
OTOBO
Flexible open‑source ticketing and ITSM for service organizations
Backdrop CMS
Easy‑to‑use, performance‑focused content management
Homer
Static dashboard for your services
Papra
Minimalistic document archive for teams and individuals
