diff --git a/CHANGELOG.md b/CHANGELOG.md index 131c0a8..de523a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ -## 2.4.1 +## 2.4.1-wip - Update the examples to use `WebSocketChannel.ready` and clarify that `WebSocketChannel.ready` should be awaited before sending data over the `WebSocketChannel`. +- Mention `ready` in the docs for `connect`. ## 2.4.0 diff --git a/lib/src/channel.dart b/lib/src/channel.dart index 8f40d75..46d16b8 100644 --- a/lib/src/channel.dart +++ b/lib/src/channel.dart @@ -134,6 +134,12 @@ class WebSocketChannel extends StreamChannelMixin { /// communicate over the resulting socket. /// /// The optional [protocols] parameter is the same as `WebSocket.connect`. + /// + /// A WebSocketChannel is returned synchronously, however the connection is + /// not established synchronously. + /// The [ready] future will complete after the channel is connected. + /// If there are errors creating the connection the [ready] future will + /// complete with an error. factory WebSocketChannel.connect(Uri uri, {Iterable? protocols}) => platform.connect(uri, protocols: protocols); } diff --git a/pubspec.yaml b/pubspec.yaml index 79be718..1403492 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: web_socket_channel -version: 2.4.1 +version: 2.4.1-wip description: >- StreamChannel wrappers for WebSockets. Provides a cross-platform