Add IOWebSocketChannel.innerWebSocket Supersedes dart-lang/web_socket_channel#141 - expose the entire `dart:io` web socket instead of selectively forwarding more parts of the interface. This does not cover the case of changing a setting immediately after the socket is connected. As a followup we may want to add a `Future<WebSocketChannel> get onConnected` to have a signal on connection and enable immediately setting options.
diff --git a/pkgs/web_socket_channel/CHANGELOG.md b/pkgs/web_socket_channel/CHANGELOG.md index e099326..da9bb62 100644 --- a/pkgs/web_socket_channel/CHANGELOG.md +++ b/pkgs/web_socket_channel/CHANGELOG.md
@@ -1,3 +1,8 @@ +## 2.1.0-dev + +- Add `IOWebSocketChannel.innerWebSocket` getter to access features not exposed + through the shared `WebSocketChannel` interface. + ## 2.0.0 - Support null safety.
diff --git a/pkgs/web_socket_channel/lib/io.dart b/pkgs/web_socket_channel/lib/io.dart index f90e103..8453ca8 100644 --- a/pkgs/web_socket_channel/lib/io.dart +++ b/pkgs/web_socket_channel/lib/io.dart
@@ -35,7 +35,11 @@ @override final WebSocketSink sink; - // TODO(nweiz): Add a compression parameter after the initial release. + /// The underlying [WebSocket], if this channel has connected. + /// + /// `If the future returned from [WebSocket.connect] has not yet completed, or + /// completed as an error, this will be null. + WebSocket? get innerWebSocket => _webSocket; /// Creates a new WebSocket connection. ///
diff --git a/pkgs/web_socket_channel/pubspec.yaml b/pkgs/web_socket_channel/pubspec.yaml index 9454c65..5e40dcc 100644 --- a/pkgs/web_socket_channel/pubspec.yaml +++ b/pkgs/web_socket_channel/pubspec.yaml
@@ -1,5 +1,5 @@ name: web_socket_channel -version: 2.0.0 +version: 2.1.0-dev description: >- StreamChannel wrappers for WebSockets. Provides a cross-platform @@ -8,7 +8,7 @@ repository: https://github.com/dart-lang/web_socket_channel environment: - sdk: ">=2.12.0-0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: async: ^2.5.0