pusher_client
2.0.0, released 5 years ago by an unverified publisher
Flutter plugin for Pusher Channels providing WebSocket communication on Android and iOS.
What it does
It wraps the native Pusher WebSocket SDKs for Java and Swift, exposing a Dart API to connect, subscribe to channels, bind events, and trigger client events. It supports public, private, encrypted, and presence channels.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need real‑time updates via Pusher Channels in a Flutter app
- You target Android and iOS and want a ready‑made client rather than implementing the protocol yourself
Skip it when
- You require a pure Dart WebSocket solution without native code
- You need WebSocket support on web, desktop, or other platforms not covered by this plugin
Strengths
- Native SDKs give reliable connection handling
- Supports all Pusher channel types including encrypted and presence
- Provides callbacks and stream‑like event handling
Weaknesses
- Only works on Android and iOS; no web/desktop support
- Requires native configuration (Podfile, Proguard)
- Adds native binary size overhead
Setup
- Kind
- Plugin (native code)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 0
Add iOS deployment target >=9.0 in Podfile, optionally configure NSAppTransportSecurity. For Android, add Proguard keep rule if code obfuscation is enabled.
import 'package:pusher_client/pusher_client.dart';
void main() {
var options = PusherOptions(
host: 'example.com',
wsPort: 6001,
encrypted: false,
auth: PusherAuth('http://example.com/auth', headers: {'Authorization':'Bearer token'}),
);
var pusher = PusherClient('YOUR_APP_KEY', options);
pusher.connect();
var channel = pusher.subscribe('private-orders');
channel.bind('order-status-updated', (event) => print(event.data));
}Alternatives
Packages that do the same job and could replace pusher_client.
- web_socket_channel
Pure Dart WebSocket client that works on all Flutter platforms, no native code
83Compare - shelf_web_socket
Server‑side WebSocket library for Dart, useful if you control the backend
80Compare - http_multi_server
Provides low‑level socket handling for custom protocols
90Compare