phoenix_socket
0.8.0, released 2 years ago by braver.health
Dart implementation of Phoenix Sockets and Channels over WebSockets.
What it does
PhoenixSocket provides a feature-complete implementation of Phoenix Sockets using StreamChannels, allowing Dart and Flutter applications to interact with Phoenix Channels and Presence over WebSockets. It replicates the JavaScript Phoenix client API while leveraging Dart's native Streams and Futures.
AI-written summary of version 0.8.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to connect a Flutter app to a Phoenix backend using Channels.
- You want real-time bi-directional communication via WebSockets using a familiar Phoenix socket API.
Skip it when
- You are communicating with a standard REST or GraphQL backend instead of Phoenix Sockets.
- You require a completely out-of-the-box solution for non-Phoenix WebSocket servers without adapting to the Phoenix protocol.
Strengths
- Consistent API across web and native environments using web_socket_channel.
- Built-in support for auto-reconnection and channel management.
Weaknesses
- Presence support is currently experimental.
- Limited specifically to the Phoenix framework's channel protocol.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
Add the dependency to pubspec.yaml and import it.
import 'package:phoenix_socket/phoenix_socket.dart';
final socket = PhoenixSocket('ws://localhost:4000/socket/websocket');
await socket.connect();Alternatives
Packages that do the same job and could replace phoenix_socket.
- socket_io_common
Socket.io common parser library for Dart.
47Compare
Works with
Packages commonly used together with phoenix_socket: ones it builds on, ones built on it, and its own family.
- loggingphoenix_socket depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- web_socket_channelphoenix_socket depends on itCross‑platform WebSocket channel wrapper for Dart
- rxdartphoenix_socket depends on itImplementation of the ReactiveX API for asynchronous programming leveraging native Dart Streams.