Skip to main content

Install

Centrifugo provides official client SDKs for most platforms: For the full list including community SDKs, see the Centrifugo client SDK docs.

Connect

Fetch a token using your API key, then instantiate and connect the Centrifuge client. You only need one client instance — all channel subscriptions are multiplexed over the single connection. If you need more than 512 subscriptions, create additional client instances (each connection supports up to 512 channels). See Limits for details.

Subscribe to a channel

Once connected, create a subscription for the channel you want. All channel pages in this section use this same pattern — replace "channel:name" with the channel name format documented on each page.
Pass positioned: true, recoverable: true together on channels with history enabled to get at-least-once delivery across reconnects. See Namespace history capabilities for which channels support this, and Best Practices for how to handle recovery outcomes.
Each publication event exposes a ctx object with the following structure:
ctx.data is the channel payload documented on each channel’s reference page. ctx.tags.messageId is a UUID present on every publication — use it to deduplicate messages during history recovery (see Real-time Data → Dedup).

Cleanup

When you no longer need a subscription, clean it up to free resources:
Last modified on March 27, 2026