adapter_websocket
A Flutter WebSocket adapter with auto-reconnect, heartbeat, interceptors, ACK confirmation, message queuing, topic multiplexing, and connection pooling.
What this package is like to depend on
Last release 10 days ago
13 Aug 2026
Release timing varies
gaps range from 2 weeks to 11 months
Most releases are documented
notes for 9 of 14 stable releases
Nothing withdrawn
no release was ever pulled
1 years old
14 releases · first in 2025
8 releases in the last 12 months
see the full history below
Release timeline
14 releases · Jun 2025 to Aug 2026
2026
Releases
latest 14-
0.1.813 Aug 2026Release notes
Open source →Bug Fixes
- Connection: Fixed a race in
WebSocketChannelAdapter.connect()where a stale connection's callbacks could overwrite the state of a newer one, subscriptions leaked across reconnects, and a stalled handshake could leaveconnect()hanging forever (connection generation counting + timeout now terminates the pending future). - ACK: Fixed
__ack__-pending messages being silently lost on disconnect — pending ACKs are now requeued for redelivery and late ACK frames are consumed instead of leaking into the message stream. - ACK / Queue: Draining the message queue no longer blocks behind one unacknowledged ACK message (previously up to
ackTimeout × maxAckRetries), and failed sends while connected now fall back to the queue instead of being lost. - Heartbeat: Fixed a race where
stop()during an in-flight heartbeat send could re-arm a zombie timeout timer and trigger auto-reconnect after an intentional disconnect. - Heartbeat: The mechanism now deactivates cleanly after
maxMissedHeartbeats(stats no longer report a dead heartbeat as active) and can be restarted after reconnection. - Reconnection: Fixed disconnections that occurred while a reconnect attempt was in flight being swallowed, which could leave the client permanently offline; superseded attempts can no longer report success or cancel a newer cycle. Also fixed an exponent overflow crash in exponential backoff with unlimited retries.
- Topics:
ChannelManager.route()no longer throws on malformed envelopes from the server (non-stringtopic/eventvalues are now guarded instead of hardcast). - Interceptors: The public
errorStreamnow forwards errors through the error interceptor chain — returningnullfromonErroractually suppresses the error, matchingonSend/onReceivesemantics. - Added
WebSocketClient.isReconnectingto distinguish "disconnected" from "automatically reconnecting".
Improvements
- Restored the web platform declaration in
pubspec.yaml(a Dart-only registrant viadartPluginClass) so pub.dev correctly shows web support — it had been dropped accidentally in 0.1.7. - Added a canonical entry point at
package:adapter_websocket/adapter_websocket.dart; the oldwebsocket_plugin.dartimport remains as a backwards-compatible alias.
Example
- Added a self-driving in-process mock WebSocket server (
example/lib/local_mock_websocket_adapter.dart) that answers heartbeat/ACK/topic traffic and broadcasts periodic events with zero network access — switch between Mock (local) and Real server right in the demo UI. Native builds use a real local WebSocket server; web builds use an in-memory transport with identical behaviour.
Tests
- Added 13 regression tests covering all of the above fixes, plus an example integration test exercising the full mock flow (echo, ACK, heartbeat, topics, simulated disconnect → auto-reconnect).
- Made the previously jitter-dependent exponential-backoff test deterministic.
- Connection: Fixed a race in
-
0.1.726 May 2026Release notes
Open source →New Features
WebSocketMessagenow has acopyWith()method for convenient object duplication.
Improvements
- ACK:
AckManager.sendWithAck()now embeds__ack_id__directly into the JSON payload so the server can echo it back without out-of-band framing. - Message Queue: Added
useAckflag support; messages that were originally sent with ACK enabled are re-enqueued with the flag preserved and re-sent with ACK on reconnect. - Channel Manager:
ChannelManagernow passes aWebSocketMessage(instead of raw data) to the underlying send path, enabling full interceptor and ACK pipeline support for topic messages. - Reconnection Manager: Infinite-retry configuration (
maxReconnectAttempts = 0) is now displayed correctly in connection stats. - WebSocket Client: Refactored the message stream processing pipeline for clearer separation between raw transport, interceptor chain, and topic dispatch.
- WebSocketConfig.copyWith(): Supports explicit
nullclearing for optional fields (e.g.httpClient,expectedPongMessagePattern) so callers can reset a field without creating a whole new config. - README: Extended cross-platform availability table to document which configuration fields are supported on Web vs. native.
Build
- Updated package version to
0.1.7. - Removed resource files that are not supported on the Web platform from the asset bundle.
-
0.1.623 May 2026Release notes
Open source →Bug Fixes
- Fixed Swift Package Manager (SPM) support for iOS and macOS: added
Package.swiftatios/adapter_websocket/Package.swiftandmacos/adapter_websocket/Package.swift, which is the path Flutter's SPM integration actually resolves. The previously existing root-levelios/Package.swiftandmacos/Package.swiftwere not found by the pub.dev validator or Flutter tooling.
- Fixed Swift Package Manager (SPM) support for iOS and macOS: added
-
0.1.523 May 2026Release notes
Open source →Improvements
- Explicitly declared the web platform in
pubspec.yaml(pluginClass: none), confirming that web WebSocket support is handled entirely in Dart viaweb_socket_channelwith no native plugin class required.
- Explicitly declared the web platform in
-
0.1.423 May 2026Release notes
Open source →Improvements
- Removed unused plugin scaffold files (
adapter_websocket_web.dart,untitled5_method_channel.dart,websocket_platform_interface.dart) that were generated byflutter create --template=pluginbut never wired into actual functionality. - Removed corresponding unused dependencies:
flutter_web_plugins,plugin_platform_interface. - Removed the empty web plugin class registration from
pubspec.yaml; web WebSocket support continues to work throughweb_socket_channel.
- Removed unused plugin scaffold files (
-
0.1.323 May 2026Release notes
Open source →Improvements
- Refactored
WebSocketChannelAdapterinternals to fully support the WASM platform, removing remainingdart:iodependencies from the connection path via conditional imports. - Improved
CompressionInterceptorreliability on native platforms. - Added GitHub Pages live demo (automatically deployed on every push to
master).
- Refactored
-
0.1.122 May 2026Release notes
Open source →Bug Fixes
- Fixed messages whose content contains the heartbeat string (e.g. JSON payloads that include
"ping"or"pong") being incorrectly classified as heartbeat responses.
Improvements
- Refactored example application with additional usage demos and improved UI.
- Added iOS and Dart CI workflows.
- Fixed messages whose content contains the heartbeat string (e.g. JSON payloads that include
-
0.1.022 May 2026Release notes
Open source →New Features
- Interceptor / Middleware —
WebSocketInterceptorabstract class andInterceptorChainfor inspecting, transforming, or suppressing messages at send and receive time. Ships with a built-inLoggingInterceptor. - Message Queue (offline buffer) —
MessageQueuebuffers outgoing messages while the connection is down and automatically flushes them on reconnect. Configurable viaenableMessageQueue,maxQueueSize, andmessageQueueTimeout. - ACK Confirmation —
AckManagerinjects a unique__ack_id__into outgoing messages and waits for server acknowledgement. Supports configurable timeout and automatic retries. Configurable viaenableAck,ackTimeout, andmaxAckRetries. - Topic Multiplexing (Channel/Topic) —
ChannelManagerandWebSocketTopicenable multiple logical channels over a single WebSocket connection using a JSON envelope format ({"topic":"…","event":"…","payload":…}). Access viaclient.channel('topic:name'). - Compression —
CompressionInterceptortransparently gzip-compresses outgoing messages above a configurable byte threshold and decompresses incoming messages. Available on native platforms (not web). - Connection Pool —
WebSocketPoolmanages multipleWebSocketClientinstances across different server endpoints with round-robin, random, or least-connections load balancing. Supportsbroadcast()to all connected clients.
Improvements
WebSocketConfig.copyWith()now includesexpectedPongMessagePattern.WebSocketClientmessage pipeline runs through the interceptor chain before sending and after receiving.WebSocketClient.send()andsendMessage()enqueue messages when disconnected (ifenableMessageQueueis enabled) instead of immediately throwing.- Queue is drained automatically on reconnect success (both from
connect()and from the reconnection manager). connectionStatsnow includesmessageQueue,ack,channels, andinterceptorsfields.
Bug Fixes
- Fixed
_isHeartbeatMessage()null dereference when onlyexpectedPongMessagewas set. - Fixed
copyWith()droppingexpectedPongMessagePattern. - Fixed heartbeat pong waiting logic ignoring
expectedPongMessagePattern. - Fixed
handleIncomingMessage()not recognising pong responses matched byexpectedPongMessagePattern. - Fixed
WebSocketClient._publishStats()not being called after initiating reconnection from heartbeat timeout. - Fixed shadowed variable in
reconnection_manager_test.dartcausing NullPointerException. - Fixed
ReconnectionManagertimer leak between tests by addingtearDown. - Fixed
reconnection_manager_test.dart"max attempts" test not waiting long enough for exponential backoff. - Fixed
websocket_plugin_test.dartunstable-connection test relying on 30-second instability timer.
- Interceptor / Middleware —
-
0.0.701 Jul 2025Nothing published for this version
-
0.0.625 Jun 2025Nothing published for this version
-
0.0.525 Jun 2025Nothing published for this version
-
0.0.425 Jun 2025Nothing published for this version
-
0.0.315 Jun 2025Nothing published for this version
-
0.0.207 Jun 2025