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()); + } }