Skip to content
pubscout

centrifuge

0.21.0, released 4 weeks ago by an unverified publisher

Dart client for real‑time communication with Centrifuge/Centrifugo over WebSockets.

WASM-ready
$ flutter pub add centrifuge
Source repository

What it does

Provides a WebSocket‑based client that connects to Centrifugo or Centrifuge servers, handling connection lifecycle, subscriptions, and token refresh. It works on Flutter, web and desktop platforms.

AI-written summary of version 0.21.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need real‑time messaging with a Centrifugo/Centrifuge backend
  • Your app runs on multiple platforms (mobile, web, desktop) and requires a unified WebSocket client

Skip it when

  • You are not using Centrifugo/Centrifuge or need a generic WebSocket client only
  • You require a UI‑focused solution rather than a low‑level protocol client

Strengths

  • Cross‑platform (Android, iOS, web, Windows, macOS, Linux)
  • Built‑in token handling and reconnection logic
  • Extensive test coverage and stability fixes

Weaknesses

  • Tied to Centrifugo/Centrifuge ecosystem
  • No UI components, only low‑level client

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
4

Add the package, configure endpoint and optional getToken/getData callbacks; handle background lifecycle manually if needed

import 'package:centrifuge/centrifuge.dart';

void main() async {
  final client = Centrifuge('wss://example.com/connection');
  client.setToken('your-token');
  await client.connect();
  final sub = client.newSubscription('chat');
  await sub.subscribe();
}

Alternatives

Packages that do the same job and could replace centrifuge.

Works with

Packages commonly used together with centrifuge: ones it builds on, ones built on it, and its own family.