socket_io_lite 0.1.0
socket_io_lite: ^0.1.0 copied to clipboard
Lightweight, zero-dependency Socket.IO client for Dart & Flutter.
0.1.0 #
Initial release.
- Zero-dependency Socket.IO client for Dart & Flutter (Engine.IO v4 / Socket.IO v4).
- Native WebSocket transport (
dart:io) with automatic heartbeat (server ping / client pong) and a missed-heartbeat watchdog. SocketIoLite.connect,on,off,emit,onConnect,onDisconnect,onError,disconnect, anddispose.- Namespaces, connection auth payload, query params, and pre-connect emit buffering.
- Acknowledgements:
emitWithAckwith optionalackTimeout. - Automatic reconnection with exponential backoff (
reconnection,reconnectionAttempts,reconnectionDelay,reconnectionDelayMax) andonReconnect/onReconnectAttempt/onReconnectFailed. - Event helpers:
once,onAny/offAny, andonAck/offAck(respond to server events that expect an acknowledgement). - Multiplexed namespaces:
socket.of('/ns')shares a single WebSocket across namespaces (Manager + Socket architecture), each with its own CONNECT, listeners, and acks. - Variadic emit:
emit(event, arg1, arg2, ...)and the same foremitWithAck, matching Socket.IO's multi-argument events (e.g. WebRTC signaling). Incoming multi-argument events are delivered to handlers as aList. An explicitly passednullis now sent as an argument (previously omitted). - Web support via
dart:htmlWebSocket, selected automatically through a conditional import — one API across native, web, and desktop. The web build compiles and shares the same protocol layer that is tested on the VM. - Verified end-to-end against a real
socket.iov4 server on both native and web (browser) transports.
Note: web uses dart:html, which compiles with the standard JS web build; the
Wasm build (--wasm) is not supported yet.