Skip to content

Commit

Permalink
adjust the HtmlWebSocketChannel ctor parameter type; rev to 2.4.3 (#320)
Browse files Browse the repository at this point in the history
adjust the HtmlWebSocketChannel ctor parameter type
  • Loading branch information
devoncarew authored Jan 8, 2024
1 parent 0e8bedc commit 041aa3c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [3.2.0, dev]
sdk: [3.2, dev]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
Expand All @@ -60,3 +60,12 @@ jobs:
- name: Run Chrome tests - wasm
run: dart test --platform chrome --compiler dart2wasm
if: always() && steps.install.outcome == 'success' && matrix.sdk == 'dev'

# Run analysis against the oldest supported pub constraints.
downgrade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d
- run: dart pub downgrade
- run: dart analyze --fatal-infos
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## 2.4.2
## 2.4.3

- `HtmlWebSocketChannel`: Relax the type of the websocket parameter to the
constructor in order to mitigate a breaking change introduced in `2.4.1`.

## 2.4.2 (retracted)

- Allow `web: '>=0.3.0 <0.5.0'`

## 2.4.1
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
[![CI](https://github.com/dart-lang/web_socket_channel/actions/workflows/test-package.yml/badge.svg?branch=master)](https://github.com/dart-lang/web_socket_channel/actions/workflows/test-package.yml)
[![pub package](https://img.shields.io/pub/v/web_socket_channel.svg)](https://pub.dev/packages/web_socket_channel)
[![package publisher](https://img.shields.io/pub/publisher/web_socket_channel.svg)](https://pub.dev/packages/web_socket_channel/publisher)

The `web_socket_channel` package provides [`StreamChannel`][stream_channel]
wrappers for WebSocket connections. It provides a cross-platform
`package:web_socket_channel` provides cross-platform
[`StreamChannel`][stream_channel] wrappers for WebSocket connections.

## Docs and Usage

It provides a cross-platform
[`WebSocketChannel`][WebSocketChannel] API, a cross-platform implementation of
that API that communicates over an underlying [`StreamChannel`][stream_channel],
[an implementation][IOWebSocketChannel] that wraps `dart:io`'s `WebSocket`
Expand Down
8 changes: 6 additions & 2 deletions lib/html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ class HtmlWebSocketChannel extends StreamChannelMixin
)..binaryType = (binaryType ?? BinaryType.list).value,
);

/// Creates a channel wrapping [innerWebSocket].
HtmlWebSocketChannel(this.innerWebSocket) {
/// Creates a channel wrapping [webSocket].
///
/// The parameter [webSocket] should be either a dart:html `WebSocket`
/// instance or a package:web [WebSocket] instance.
HtmlWebSocketChannel(Object /*WebSocket*/ webSocket)
: innerWebSocket = webSocket as WebSocket {
_readyCompleter = Completer();
if (innerWebSocket.readyState == WebSocket.OPEN) {
_readyCompleter.complete();
Expand Down
5 changes: 2 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: web_socket_channel
version: 2.4.2

version: 2.4.3
description: >-
StreamChannel wrappers for WebSockets. Provides a cross-platform
WebSocketChannel API, a cross-platform implementation of that API that
Expand All @@ -14,7 +13,7 @@ dependencies:
async: ^2.5.0
crypto: ^3.0.0
stream_channel: ^2.1.0
web: '>=0.3.0 <0.5.0'
web: ^0.4.0

dev_dependencies:
dart_flutter_team_lints: ^2.0.0
Expand Down

0 comments on commit 041aa3c

Please sign in to comment.