adapter_websocket 0.1.0
adapter_websocket: ^0.1.0 copied to clipboard
Adapter websocket
0.1.0 #
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.
0.0.2 #
- TODO: Describe initial release.