Update to handle Socket implements Stream<Uint8List> (#65)
A recent change in the Dart SDK updated `Socket` to
implement `Stream<Uint8List>` rather than `Stream<List<int>>`.
This forwards compatible change calls `StreamTransformer.bind()`
rather than `Stream.transform()`, thus putting the stream in a
covariant position and allowing for the transition to `Uint8List`.
https://github.com/dart-lang/sdk/issues/36900
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5240a85..d446637 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.0.14
+
+* Updates to handle `Socket implements Stream<Uint8List>`
+
## 1.0.13
* Internal changes for consistency with the Dart SDK.
diff --git a/lib/src/copy/web_socket_impl.dart b/lib/src/copy/web_socket_impl.dart
index 6ac07cf..552b3e4 100644
--- a/lib/src/copy/web_socket_impl.dart
+++ b/lib/src/copy/web_socket_impl.dart
@@ -607,7 +607,7 @@
onResume: _onResume,
onCancel: _onListen);
var stream =
- _controller.stream.transform(_WebSocketOutgoingTransformer(webSocket));
+ _WebSocketOutgoingTransformer(webSocket).bind(_controller.stream);
sink.addStream(stream).then((_) {
_done();
_closeCompleter.complete(webSocket);
@@ -709,7 +709,7 @@
_readyState = WebSocket.OPEN;
var transformer = _WebSocketProtocolTransformer(_serverSide);
- _subscription = stream.transform(transformer).listen((data) {
+ _subscription = transformer.bind(stream).listen((data) {
if (data is _WebSocketPing) {
if (!_writeClosed) _consumer.add(_WebSocketPong(data.payload));
} else if (data is _WebSocketPong) {
diff --git a/pubspec.yaml b/pubspec.yaml
index b4cdedc..92a8e98 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: web_socket_channel
-version: 1.0.13
+version: 1.0.14
description: >-
StreamChannel wrappers for WebSockets. Provides a cross-platform