socket_io
1.0.1, released 5 years ago by an unverified publisher
Dart server and client implementation of Socket.io for real‑time bidirectional communication.
What it does
Provides a Server class to host a Socket.io server and a client library to connect from Dart. Supports namespaces, rooms, and both polling and WebSocket transports, mirroring the JavaScript Socket.io API.
AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need real‑time, event‑driven communication between Dart/Flutter apps and a backend that already uses Socket.io
- You want built‑in support for namespaces and rooms without writing low‑level WebSocket handling
Skip it when
- A simple HTTP/REST request is sufficient
- You need the latest Socket.io v3+ features that this package (v2) may not support
Strengths
- Namespace and room abstractions are provided out of the box
- Null‑safety and future‑based start/stop API
- Works on all major platforms (mobile, desktop, server)
Weaknesses
- Implements only Socket.io v2.0.1, may lag behind newer server versions
- Less active community compared to raw WebSocket packages
- No code‑generation or declarative API
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 4
import 'package:socket_io/socket_io.dart';
void main() {
var io = Server();
var nsp = io.of('/chat');
nsp.on('connection', (client) {
client.on('msg', (data) => client.emit('fromServer', 'ok'));
});
io.listen(3000);
}Alternatives
Packages that do the same job and could replace socket_io.
- web_socket_channel
Provides a lightweight, low‑level WebSocket client/server without Socket.io overhead, suitable for simple real‑time needs
83Compare - shelf_web_socket
Allows building WebSocket endpoints on the server side using the Shelf ecosystem
80Compare
Works with
Packages commonly used together with socket_io: ones it builds on, ones built on it, and its own family.