dart_pusher_channels
1.3.1, released 9 months ago by kerim.app
Pure‑Dart client for the Pusher Channels real‑time protocol.
What it does
Provides a WebSocket‑based client that connects to Pusher Channels, handling authentication, subscription to public, private, presence and encrypted channels, and event binding/triggering. It abstracts the protocol details and offers reconnection and activity‑ping handling.
AI-written summary of version 1.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need real‑time messaging via Pusher Channels across mobile, web and desktop.
- You want a cross‑platform Dart/Flutter solution without native plugins.
- You require support for presence and encrypted private channels.
Skip it when
- You are using a different real‑time backend (e.g., Firebase, Supabase).
- You need fallback transports like long‑polling or SSE.
Strengths
- Cross‑platform (Android, iOS, web, Windows, macOS, Linux).
- Supports all Pusher channel types (public, private, presence, encrypted).
- Stream‑based API integrates well with RxDart and Flutter streams.
Weaknesses
- Limited to Pusher Channels only; not a generic WebSocket client.
- No built‑in UI widgets; you must handle UI updates yourself.
- Relies on web_socket_channel; advanced reconnection strategies may require custom code.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 5
```dart
import 'package:dart_pusher_channels/dart_pusher_channels.dart';
final options = PusherChannelsOptions.fromCluster(
scheme: 'wss',
cluster: 'mt1',
key: 'YOUR_KEY',
host: 'pusher.com',
shouldSupplyMetadataQueries: true,
metadata: PusherChannelsOptionsMetadata.byDefault(),
port: 443,
);
final client = PusherChannelsClient.websocket(
options: options,
connectionErrorHandler: (e, t, refresh) => refresh(),
);
await client.connect();
await client.subscribe('my-channel');
client.bind('my-event', (event) => print('Received: ${event.data}'));
```Alternatives
Packages that do the same job and could replace dart_pusher_channels.
- http2
An HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.
91Compare - pubnub
PubNub SDK for Dart and Flutter to build real-time messaging applications
84Compare - connectrpc
Implementation of the Connect protocol for Dart, supporting Protobuf, gRPC, and gRPC-Web.
79Compare - connectanum
A Dart/Flutter client implementing the WAMP protocol for RPC and Pub/Sub.
69Compare
Works with
Packages commonly used together with dart_pusher_channels: ones it builds on, ones built on it, and its own family.
- web_socket_channeldart_pusher_channels depends on itCross‑platform WebSocket channel wrapper for Dart
- rxdartdart_pusher_channels depends on itImplementation of the ReactiveX API for asynchronous programming leveraging native Dart Streams.
- pinenacldart_pusher_channels depends on itDart implementation of TweetNaCl cryptographic library with high-level APIs