centrifuge
0.21.0, released 4 weeks ago by an unverified publisher
Dart client for real‑time communication with Centrifuge/Centrifugo over WebSockets.
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.
- openai_realtime_dart
Dart client for the OpenAI Realtime API over WebSockets
79Compare - mqtt5_client
A server and browser based MQTT Version 5 client for Dart supporting TCP and WebSockets.
92Compare - mqtt_client
A Dart MQTT client supporting TCP, WebSocket, secure connections and all QoS levels.
91Compare - angel3_websocket
WebSockets support and event broadcasting for the Angel3 framework.
77Compare
Works with
Packages commonly used together with centrifuge: ones it builds on, ones built on it, and its own family.
- web_socket_channelcentrifuge depends on itCross‑platform WebSocket channel wrapper for Dart
- fixnumcentrifuge depends on itProvides 32‑ and 64‑bit signed fixed‑width integer types for Dart.
- protobufcentrifuge depends on itProvides runtime support for Dart protocol buffer messages generated by protoc_plugin.