Centrifugo is an open-source scalable real-time messaging server. It instantly delivers messages to application online users connected over supported transports (WebSocket, HTTP-streaming, Server-Sent Events (SSE), GRPC, WebTransport). Centrifugo is built around channel subscriptions – so it's a user-facing PUB/SUB server.
Centrifugo is language-agnostic and can be used to build chat apps, live comments, multiplayer games, real-time data visualizations, collaborative tools, AI streaming responses, etc. in combination with any backend. It is well suited for modern architectures and allows decoupling the business logic from the real-time transport layer.
Official client SDKs are available for JavaScript (browser, Node.js, React Native), Dart/Flutter, Swift, Java, Python, Go, Rust, and .NET. In addition, Centrifugo supports a unidirectional approach for simple use cases with no SDK dependency.
For details, go to the Centrifugo documentation site. For runnable demos see centrifugal/examples.
What's changed
Improvements
- Official skill for Centrifugo – helps to reduce errors and the cost of agent development with Centrifugo.
- Per-connection client command rate limit. The new
client.rate_limitoption limits the rate of commands each connection may send. Every command counts, exceptconnect.actionsets what a command over the limit gets:reject(default) answers it with error111,disconnectcloses the connection with code3013. Usedisconnectfor protection – a rejected command still costs reading and answering it, so rejecting does not stop a flooding client – together with a limit on how fast clients can open connections (per IP in front of Centrifugo is recommended).unsubscribeanduntrackare never rejected, withdisconnectthey close the connection like other commands. Rate limiting is off by default. Configuration written for it works unchanged in Centrifugo PRO, which extends it. (#1315, #1355).
Fixes
client.allowed_originsis now enforced on HTTP-based connection endpoints. Before, on HTTP-streaming, SSE, unidirectional HTTP-streaming and SSE, the emulation endpoint and the init endpoint, it only decided whether to add CORS headers, and the request itself was always served. A browser sends CORS-simple requests (for example, atext/plainPOST) without a preflight, so a page of a disallowed origin could make Centrifugo connect a user with their cookies and run commands such as publish or RPC. The page could not read the responses, but the commands ran. WebSocket, unidirectional WebSocket and WebTransport already rejected disallowed origins. Reported by @draarivpatel-ui (GHSA-3r6c-vgv7-h9mr, #1359). Now, on all connection endpoints (seeclient.allowed_origins):- a request with a disallowed
Origin, alsoOrigin: null(sent after a cross-origin redirect or from a sandboxed page), gets403; - browser navigations and resource loads (links,
<img>,<iframe>) started from another site get403, as they carry the user's cookies withoutOrigin. Not withallowed_originsset to["*"]; - a request the browser marks with
Sec-Fetch-Site: same-originis always allowed, so a page served from Centrifugo's own origin works with emptyallowed_origins; - requests without
Origin(non-browser clients) work as before; - the warning on start for
allowed_origins: ["*"]now explains the risk with cookie-based authentication. - Behavior change: with empty
allowed_origins, a page of another origin now gets403on HTTP-based transports, as it already did on WebSocket. If browsers connect over HTTP-streaming or SSE from another origin, list it inallowed_originsbefore upgrading.
- a request with a disallowed
- JWKS: with
jwks_public_endpointset to a URL whose path ends with a slash (for examplehttps://auth.example.com/jwks/), every key fetch failed withJWKS URL path contains traversal sequences, so no token could be verified. Paths with..are still rejected. Thanks @shaurya703 (#1357).
Miscellaneous
- This release is built with Go 1.27.4.
- Dependency updates.
- See also the corresponding Centrifugo PRO release.