ds_websocket_socket_io
Standalone Dart package for event-based WebSocket connections built on
ds_websocket_base.
Note: pub.dev package names cannot contain dots, so the publishable package name is ds_websocket_socket_io.
Features
- Uses the DartStream
DSWebSocketProviderinterface (ds_websocket_base) - Configuration object (
DsSocketIoConfig) with option-to-map conversion - Provider implementation (
DsSocketIoProvider) and client wrapper (DsSocketIoClient)
Usage
import 'package:ds_websocket_socket_io/ds_websocket_socket_io.dart';
void main() {
final client = DsSocketIoClient(
DsSocketIoConfig(
uri: Uri.parse('https://example.com'),
transports: ['websocket'],
autoConnect: false,
),
);
client.on('connect', (_) => print('connected'));
client.on('message', (data) => print('message: $data'));
client.connect();
client.emit('message', {'hello': 'world'});
}
Roadmap
- Add a dedicated Socket.IO protocol provider if/when required by DartStream.