adapter_websocket 0.1.5 copy "adapter_websocket: ^0.1.5" to clipboard
adapter_websocket: ^0.1.5 copied to clipboard

A Flutter WebSocket adapter with auto-reconnect, heartbeat, interceptors, ACK confirmation, message queuing, topic multiplexing, and connection pooling.

0.1.4 #

Improvements #

  • Removed unused plugin scaffold files (adapter_websocket_web.dart, untitled5_method_channel.dart, websocket_platform_interface.dart) that were generated by flutter create --template=plugin but 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 through web_socket_channel.

0.1.3 #

Improvements #

  • Refactored WebSocketChannelAdapter internals to fully support the WASM platform, removing remaining dart:io dependencies from the connection path via conditional imports.
  • Improved CompressionInterceptor reliability on native platforms.
  • Added GitHub Pages live demo (automatically deployed on every push to master).

0.1.2 #

Bug Fixes #

  • Fixed CompressionInterceptor not actually applying gzip on native platforms — replaced stub with proper conditional import of dart:io GZipCodec.
  • Fixed library_private_types_in_public_api lint violations in AckManager and WebSocketTopic constructors by inlining function types.
  • Removed unnecessary library directive from websocket_plugin.dart.

Improvements #

  • WASM compatibility: removed top-level dart:io dependency from WebSocketConfig and WebSocketChannelAdapter using conditional imports; package now compiles for WASM targets.
  • Added Swift Package Manager support (Package.swift) for iOS and macOS.
  • WebSocketConfig.httpClient field is now typed as Object? to avoid a dart:io import in the public API; the native adapter casts it internally.

0.1.1 #

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.

0.1.0 #

New Features #

  • Interceptor / MiddlewareWebSocketInterceptor abstract class and InterceptorChain for inspecting, transforming, or suppressing messages at send and receive time. Ships with a built-in LoggingInterceptor.
  • Message Queue (offline buffer)MessageQueue buffers outgoing messages while the connection is down and automatically flushes them on reconnect. Configurable via enableMessageQueue, maxQueueSize, and messageQueueTimeout.
  • ACK ConfirmationAckManager injects a unique __ack_id__ into outgoing messages and waits for server acknowledgement. Supports configurable timeout and automatic retries. Configurable via enableAck, ackTimeout, and maxAckRetries.
  • Topic Multiplexing (Channel/Topic)ChannelManager and WebSocketTopic enable multiple logical channels over a single WebSocket connection using a JSON envelope format ({"topic":"…","event":"…","payload":…}). Access via client.channel('topic:name').
  • CompressionCompressionInterceptor transparently gzip-compresses outgoing messages above a configurable byte threshold and decompresses incoming messages. Available on native platforms (not web).
  • Connection PoolWebSocketPool manages multiple WebSocketClient instances across different server endpoints with round-robin, random, or least-connections load balancing. Supports broadcast() to all connected clients.

Improvements #

  • WebSocketConfig.copyWith() now includes expectedPongMessagePattern.
  • WebSocketClient message pipeline runs through the interceptor chain before sending and after receiving.
  • WebSocketClient.send() and sendMessage() enqueue messages when disconnected (if enableMessageQueue is enabled) instead of immediately throwing.
  • Queue is drained automatically on reconnect success (both from connect() and from the reconnection manager).
  • connectionStats now includes messageQueue, ack, channels, and interceptors fields.

Bug Fixes #

  • Fixed _isHeartbeatMessage() null dereference when only expectedPongMessage was set.
  • Fixed copyWith() dropping expectedPongMessagePattern.
  • Fixed heartbeat pong waiting logic ignoring expectedPongMessagePattern.
  • Fixed handleIncomingMessage() not recognising pong responses matched by expectedPongMessagePattern.
  • Fixed WebSocketClient._publishStats() not being called after initiating reconnection from heartbeat timeout.
  • Fixed shadowed variable in reconnection_manager_test.dart causing NullPointerException.
  • Fixed ReconnectionManager timer leak between tests by adding tearDown.
  • Fixed reconnection_manager_test.dart "max attempts" test not waiting long enough for exponential backoff.
  • Fixed websocket_plugin_test.dart unstable-connection test relying on 30-second instability timer.

0.0.2 #

  • TODO: Describe initial release.
2
likes
145
points
239
downloads

Documentation

API reference

Publisher

verified publisherchihero.com

Weekly Downloads

A Flutter WebSocket adapter with auto-reconnect, heartbeat, interceptors, ACK confirmation, message queuing, topic multiplexing, and connection pooling.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, web, web_socket_channel

More

Packages that depend on adapter_websocket

Packages that implement adapter_websocket