Logo Centrifugo

Development

Centrifugo

Centrifugo — real-time on your VPS: WebSocket, publish API, JWT tokens and a password-protected admin console, with no third-party service.

About Centrifugo

Centrifugo is an open-source real-time messaging server (Apache-2.0 license), written in Go. It takes care of the hardest part of real-time: keeping thousands of WebSocket connections open and delivering to each one the messages that concern it. Your application stays in PHP, Python, Node.js, Go or Ruby, and only makes an HTTP call to publish.

The principle is simple. Your backend signs a JWT for each user; the browser or mobile app uses it to open a connection on `wss://your-domain/connection/websocket`. When something happens — a paid order, a chat message, an alert — your backend calls the `/api/publish` API with its key, and Centrifugo pushes the message to every subscriber of the channel. It is a self-hosted alternative to Pusher, Ably or PubNub, with no per-message billing.

What gets installed

Ready when the VPS starts

Compatible OS
Choice of Linux distributions
Application
Centrifugo
Tech stack
DockerGoCentrifugo
Minimum RAM
1 GB minimum
Minimum CPU
1 vCPU
Default port
8113
Access
root over SSH

Key features

  • Real-time connections — WebSocket, with official client SDKs for JavaScript, Dart/Flutter, Swift, Java/Android, Go and Python.
  • Publish API — one HTTP call with the X-API-Key header is enough to send a message to a channel, from any language.
  • Token authentication — your backend signs JWTs (HS256); a connection without a valid token is refused.
  • Channels and server-side subscriptions — a user's channel list can be carried by their token, with no extra client code.
  • Admin console — node status, number of connected clients and API commands from the browser, protected by a password.
  • Lightweight — a single Go binary, a few tens of MB of RAM at rest.

When to use this solution?

Live notifications

Tell a customer the moment their order is paid or their ticket gets a reply, without them reloading the page.

Real-time chat and comments

Add messaging or instant comments to your web or mobile app; your backend keeps the logic and the database.

Dashboards that update themselves

Push counters, delivery statuses or prices to open screens instead of polling them every second.

Guide

Deploy Centrifugo on your VPS

  1. Create the VPS and choose the address

    Order an Ubuntu 24.04 VPS; 1 GB of RAM is enough to start. Centrifugo requires a domain: browsers connect to it over wss:// and your backend calls its API over HTTPS, on a stable name. It opens on a subdomain of one of your domains, or on the VPS's free subdomain (centrifugo.{dns_slug}.servorbit-dns.com), HTTPS included. No need to buy a domain name.

  2. Install Centrifugo from the Marketplace

    In your client area, select Centrifugo, choose the address and click Install. The script deploys the official container, generates the console password, the server API key and the token signing key, then configures the nginx reverse proxy over HTTPS, WebSocket included.

  3. Log in for the first time

    Open https://your-domain: the admin console asks for a password. Enter the one shown in your client area. The home page shows the node version and the number of connected clients.

  4. Retrieve your backend keys

    Connect to the VPS over SSH and read /opt/centrifugo/.env: ENCRYPTION_KEY is the server API key (X-API-Key header) and ENCRYPTION_KEY_HEX64 is the HMAC key that signs connection tokens. Store them in your application's secrets, never in code sent to the browser.

  5. Publish and connect your clients

    Your backend signs an HS256 JWT (sub = user ID, channels = channels to follow) and hands it to the browser, which connects with the centrifuge SDK on wss://your-domain/connection/websocket. Add your site's origin to CENTRIFUGO_CLIENT_ALLOWED_ORIGINS in /opt/centrifugo/docker-compose.yml, restart with docker compose up -d, then publish with a POST to https://your-domain/api/publish.

Frequently asked questions

Questions about Centrifugo

← Back to DevelopmentAll applications
The service is the same: your backend publishes, subscribed browsers receive the message live. Pusher and Ably are hosted services billed by connections and messages; Centrifugo runs on your VPS, with no per-message billing, and your data never leaves your server. In return, running the server is up to you.

Embed the deploy button

Maintaining a project that uses Centrifugo? This button lets your readers deploy it on a VPS in one click, without reading Docker documentation.

Deploy Centrifugo on ServOrbit
Markdown
[![Deploy Centrifugo on ServOrbit](https://servorbit.com/brand/deploy/button.svg)](https://servorbit.com/vps-cloud?template=centrifugo&utm_source=deploy-badge&utm_medium=referral&utm_campaign=centrifugo)
HTML
<a href="https://servorbit.com/vps-cloud?template=centrifugo&utm_source=deploy-badge&utm_medium=referral&utm_campaign=centrifugo"><img src="https://servorbit.com/brand/deploy/button.svg" alt="Deploy Centrifugo on ServOrbit" height="40"></a>

The button points to a VPS order with the template preselected. The image is served from servorbit.com — nothing to host on your side.

Need help?

Browse our help center and FAQ, or reach our team — callback, WhatsApp or email.

Message us on WhatsAppopens in a new tab