From 66d3fb2e044c4e3a3c66aa280507ae2c70a221c9 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sun, 3 Feb 2019 14:35:33 -0500 Subject: [PATCH] Close `WebSocketExtraneousEventHandler`. --- CHANGELOG.md | 1 + lib/base_websocket_client.dart | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32e6e8ef..bc2702e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 2.0.1 * Add `reconnectOnClose` and `reconnectinterval` parameters in top-level `WebSockets` constructors. +* Close `WebSocketExtraneousEventHandler`. # 2.0.0 * Update to work with `client@2.0.0`. diff --git a/lib/base_websocket_client.dart b/lib/base_websocket_client.dart index d8136211..dca21459 100644 --- a/lib/base_websocket_client.dart +++ b/lib/base_websocket_client.dart @@ -94,6 +94,7 @@ abstract class BaseWebSocketClient extends BaseAngelClient { @override Future close() async { + on._close(); await _socket.sink.close(status.goingAway); _onData.close(); _onAllEvents.close(); @@ -434,4 +435,8 @@ class WebSocketExtraneousEventHandler { return _events[index].stream; } + + void _close() { + _events.values.forEach((s) => s.close()); + } }