Skip to content

Merge package:web_socket_channel #1420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 153 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
03d6e8a
Initial template.
nex3 Feb 24, 2016
033f017
Copy the web socket stuff from http_parser.
nex3 Feb 25, 2016
8ab3304
Add an IO implementation of WebSocketChannel.
nex3 Mar 2, 2016
c1aa7fd
Get rid of WebSocketChannel.pingInterval.
nex3 Mar 2, 2016
c053965
Add an HTML implementation of WebSocketChannel.
nex3 Mar 2, 2016
23cf181
Add a top-level status library.
nex3 Mar 3, 2016
ff67146
Update the SDK constraint.
nex3 Mar 3, 2016
e8bb6fb
Add support for crypto 1.0.0..
nex3 Mar 23, 2016
8c22a3e
Use BASE64 from package:convert.
nex3 Mar 28, 2016
f8324fa
Bring in the latest version of the SDK's WebSocket impl.
nex3 May 5, 2016
d4a3f9f
WebSocket.close doesn't like passing null arguments
Fox32 May 7, 2016
e0eaef1
Add a comment explaining the new conditional.
nex3 May 9, 2016
a5c982f
Update the pubspec and add a CHANGELOG entry.
nex3 May 9, 2016
5136a8c
Merge branch 'Fox32.master'
nex3 May 9, 2016
29657f9
Fix all strong-mode errors and warnings.
nex3 May 9, 2016
66fc478
Support crypto 2.0.0.
nex3 Jun 6, 2016
ae277bc
Use hybrid tests to test the dart:html impl. (dart-lang/web_socket_ch…
nex3 Dec 27, 2016
5d64ac0
add library names; increase the sdk constraint
devoncarew Aug 4, 2017
6988e80
Merge pull request dart-lang/web_socket_channel#7 from devoncarew/sdk…
devoncarew Aug 4, 2017
fc0431d
enable travis
kevmoo Aug 4, 2017
39923b9
dartfmt
kevmoo Aug 4, 2017
06f4dba
Fix analysis warnings
kevmoo Aug 4, 2017
40542b0
cleanup gitignore
kevmoo Aug 4, 2017
5f53af5
Lint cleanup: initialize to null, return values on setter, comment sy…
kevmoo Aug 4, 2017
724299c
Remove -dev.infinity in SDK upper constraint
kevmoo Sep 19, 2017
8ba2889
Declare support for async 2.0.0 (dart-lang/web_socket_channel#9)
nex3 Sep 22, 2017
6ad1e81
Updates for Dart 2.0 corelib changes (wave 2.2)
leafpetersen Jan 31, 2018
8ec1cc3
Bring in code from the latest SDK (dart-lang/web_socket_channel#12)
nex3 Feb 10, 2018
20c810c
Stop testing on Dartium
nex3 Feb 14, 2018
08d2994
Stop testing on stable
nex3 Feb 14, 2018
9cee0f7
Merge pull request dart-lang/web_socket_channel#13 from dart-lang/fix…
nex3 Feb 14, 2018
2ea1544
Merge remote-tracking branch 'origin/corelib_2_2_1_branch'
nex3 Feb 21, 2018
e61598e
Fix wrong listener in README.md (dart-lang/web_socket_channel#18)
loint May 19, 2018
4987c7b
Remove usage of deprecated constants. (dart-lang/web_socket_channel#20)
lrhn Jun 1, 2018
568fe8a
dartfmt code and use latest pkg:test API
kevmoo Jun 29, 2018
b4b06e4
chore: set max SDK version to <3.0.0 (dart-lang/web_socket_channel#27)
chalin Jul 17, 2018
8fd103c
Fix sample code in README (dart-lang/web_socket_channel#30)
DanTup Oct 9, 2018
39992df
improve pub score (dart-lang/web_socket_channel#33)
felangel Nov 28, 2018
910570c
enable and fix a number of lints
kevmoo Mar 26, 2019
2401f0a
Fix doc links in readme
kevmoo Mar 26, 2019
3f643c3
Update README.md (dart-lang/web_socket_channel#29)
analogic Mar 26, 2019
6111df8
Update .gitignore to new `dart_tool` pub cache (dart-lang/web_socket_…
bcko Mar 26, 2019
81441b7
repo cleanup
kevmoo Mar 26, 2019
7cf41e9
Prepare for 1.0.10 (dart-lang/web_socket_channel#47)
kevmoo Mar 26, 2019
5406b14
Link and description fixes
kevmoo Mar 26, 2019
07a0aa6
Allow stream_channel version 2.x (dart-lang/web_socket_channel#48)
natebosch Mar 27, 2019
2904d39
Declare a return value of `Uint8List` in `BytesBuilder` methods (dart…
tvolkert May 22, 2019
7f2a337
Update to handle Socket implements Stream<Uint8List> (dart-lang/web_s…
tvolkert Jul 9, 2019
99d66e6
Fix pedantic dependency, update links in readme
kevmoo Jul 9, 2019
68b946c
Forward protocols parameter to WebSocket (dart-lang/web_socket_channe…
chungheepark Aug 8, 2019
836ed41
Use `drain` to reach end of stream in tests (dart-lang/web_socket_cha…
natebosch Aug 8, 2019
98e9f48
Add `WebSocketChannel.connect` factory constructor.
jacob314 Oct 11, 2019
38d3159
Require Uri.
jacob314 Oct 11, 2019
6a6630a
Merge pull request dart-lang/web_socket_channel#83 from dart-lang/con…
jacob314 Oct 11, 2019
d328a28
Fix newly enforce package:pedantic lints (dart-lang/web_socket_channe…
natebosch Dec 6, 2019
1755c74
Add Travis badge to readme
kevmoo Jan 21, 2020
13ebb73
Ignore unused fields in private class – copied from SDK
kevmoo Jan 21, 2020
cc18c87
Add optional protocols argument to WebSocketChannel.connect (dart-lan…
ganigeorgiev Feb 13, 2020
f2e5ba7
Add changelog for dart-lang/web_socket_channel#97 (dart-lang/web_sock…
natebosch Feb 13, 2020
7d6d810
Remove author from the pubspec
kevmoo Mar 15, 2020
61d32b0
Clean up some style (dart-lang/web_socket_channel#120)
natebosch Jun 1, 2020
97ab45e
use chrome to test on Travis (dart-lang/web_socket_channel#121)
kevmoo Jun 3, 2020
613c651
Add a language version tag in spawnHybridUri (dart-lang/web_socket_ch…
natebosch Nov 10, 2020
4d5a78b
Use SDK version of BytesBuilder (dart-lang/web_socket_channel#130)
natebosch Nov 10, 2020
3f369c3
Delete .test_config
kevmoo Nov 13, 2020
8f90f95
Merge pull request dart-lang/web_socket_channel#133 from dart-lang/ke…
jakemac53 Nov 13, 2020
7da76eb
Fix usage of deprecated list ctor (dart-lang/web_socket_channel#140)
natebosch Dec 30, 2020
cb5b3a1
Allow the null safe package:crypto (dart-lang/web_socket_channel#139)
natebosch Dec 30, 2020
9363836
Migrate to GitHub Actions (dart-lang/web_socket_channel#146)
athomas Jan 14, 2021
b3c6429
Enable and fix a number of lints, disallow implicit casts (dart-lang/…
kevmoo Jan 26, 2021
dafff91
Use new setup actions (dart-lang/web_socket_channel#153)
kevmoo Feb 12, 2021
d1d3229
null safety (dart-lang/web_socket_channel#154)
kevmoo Feb 12, 2021
624e2f2
prepare stable, null-safe v2 (dart-lang/web_socket_channel#155)
kevmoo Feb 19, 2021
e230f43
Latest setup, test on oldest supported SDK (dart-lang/web_socket_chan…
kevmoo Mar 31, 2021
6290154
Update LICENSE
franklinyow Apr 5, 2021
b8febe8
Merge pull request dart-lang/web_socket_channel#163 from dart-lang/fr…
franklinyow Apr 5, 2021
d60d2a3
Add IOWebSocketChannel.innerWebSocket
natebosch Apr 29, 2021
12ae6a9
Remove extra ` character (dart-lang/web_socket_channel#173)
natebosch Apr 30, 2021
b033615
Prepare to publish (dart-lang/web_socket_channel#174)
natebosch May 3, 2021
6cd8bb2
Tweak import recommendation phrasing (dart-lang/web_socket_channel#180)
micimize Jun 11, 2021
7081702
Fix IOWebSocketChannel import in readme (dart-lang/web_socket_channel…
LeonardoRosaa Jun 23, 2021
93e6300
Add HtmlWebSocketChannel.innerWebSocket (dart-lang/web_socket_channel…
chirag729 Feb 26, 2022
56f212b
Use platform agnostic example in README.md (dart-lang/web_socket_chan…
masus04 Aug 17, 2022
6d0f91c
Remove language version from spawnHybrid code (dart-lang/web_socket_c…
a-siva Oct 27, 2022
c55aa62
blast_repo fixes (dart-lang/web_socket_channel#235)
kevmoo Nov 10, 2022
ec54227
Add WebSocketChannel.`ready` field and IOWebSocketChannel factory `co…
iota9star Dec 23, 2022
8ebdb50
Bump actions/checkout from 3.1.0 to 3.2.0 (dart-lang/web_socket_chann…
dependabot[bot] Jan 3, 2023
025fc79
Update analysis_options.yaml (dart-lang/web_socket_channel#247)
srawlins Jan 10, 2023
a4f3888
Fix CI link in readme (dart-lang/web_socket_channel#248)
kevmoo Jan 10, 2023
3b2384a
Bump actions/checkout from 3.2.0 to 3.3.0 (dart-lang/web_socket_chann…
dependabot[bot] Feb 1, 2023
d279a9a
Bump dart-lang/setup-dart from 1.3 to 1.4 (dart-lang/web_socket_chann…
dependabot[bot] Feb 1, 2023
9347256
Bump actions/checkout from 3.3.0 to 3.5.0 (dart-lang/web_socket_chann…
dependabot[bot] Apr 3, 2023
db81509
Bump dart-lang/setup-dart from 1.4.0 to 1.5.0 (dart-lang/web_socket_c…
dependabot[bot] Apr 3, 2023
e0d4c64
Fix deprecated_new_in_comment_reference (dart-lang/web_socket_channel…
natebosch Apr 7, 2023
b9a7acb
Allow passing through custom http client in IO socket connect (dart-l…
Rexios80 Apr 7, 2023
7cc41ca
Bump actions/checkout from 3.5.0 to 3.5.2 (dart-lang/web_socket_chann…
dependabot[bot] May 8, 2023
2f87d84
blast_repo fixes (dart-lang/web_socket_channel#269)
devoncarew May 22, 2023
788480b
Make it more clear how `WebSocketChannel.ready` should be used. (dart…
brianquinlan Jun 20, 2023
a02b8cb
Add a note explaining why the onerror doesn't generate a more detaile…
brianquinlan Jun 21, 2023
d0f5c4b
Bump actions/checkout from 3.5.2 to 3.5.3 (dart-lang/web_socket_chann…
dependabot[bot] Jul 1, 2023
d8b8d86
Correction in Code Snippet (dart-lang/web_socket_channel#275)
jithuraj Jul 21, 2023
0a5cbc4
Bump actions/checkout from 3.5.3 to 3.6.0 (dart-lang/web_socket_chann…
dependabot[bot] Sep 1, 2023
577f267
Bump actions/checkout from 3.6.0 to 4.1.0 (dart-lang/web_socket_chann…
dependabot[bot] Oct 1, 2023
7746475
Bump dart-lang/setup-dart from 1.5.0 to 1.5.1 (dart-lang/web_socket_c…
dependabot[bot] Oct 2, 2023
e9365c2
Mention `ready` in the docs for `connect` (dart-lang/web_socket_chann…
natebosch Oct 6, 2023
2adef16
Bump actions/checkout from 4.1.0 to 4.1.1 (dart-lang/web_socket_chann…
dependabot[bot] Nov 1, 2023
198936e
Bump dart-lang/setup-dart from 1.5.1 to 1.6.0 (dart-lang/web_socket_c…
dependabot[bot] Nov 1, 2023
dd5adfd
Migrate to latest lints, bump min SDK to Dart 3.2 (dart-lang/web_sock…
kevmoo Nov 22, 2023
481ea06
migrate to pkg web (dart-lang/web_socket_channel#294)
kevmoo Nov 22, 2023
0e0de69
Small tweak (dart-lang/web_socket_channel#295)
kevmoo Nov 22, 2023
325d9bc
Drop some use of ! (dart-lang/web_socket_channel#296)
natebosch Nov 23, 2023
df37a53
Remove removed lints (dart-lang/web_socket_channel#299)
osa1 Nov 30, 2023
16acf73
Fix JS value to Dart conversion when receiving from a web socket (dar…
osa1 Dec 9, 2023
63d83c9
blast_repo fixes (dart-lang/web_socket_channel#302)
kevmoo Dec 12, 2023
098a0f1
Rename helper extensions to not collide with pkg:web unreleased (dart…
kevmoo Dec 13, 2023
b412bd7
CI: test dev SDK with dart2wasm (dart-lang/web_socket_channel#304)
kevmoo Dec 14, 2023
beca829
Prepare release v2.4.1 (dart-lang/web_socket_channel#301)
kevmoo Dec 18, 2023
9f7bc35
Bump actions/stale from 8.0.0 to 9.0.0 (dart-lang/web_socket_channel#…
dependabot[bot] Jan 1, 2024
03aff6b
Allow pkg:web v0.3.0 (dart-lang/web_socket_channel#306)
NotTsunami Jan 4, 2024
d6dca34
adjust the HtmlWebSocketChannel ctor parameter type; rev to 2.4.3 (da…
devoncarew Jan 8, 2024
3fff2ae
Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/web_socket_c…
dependabot[bot] Feb 1, 2024
6ed1dfe
Require Dart 3.3 and the latest pkg:web (dart-lang/web_socket_channel…
kevmoo Feb 15, 2024
dfc1abb
Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/web_socket_chann…
dependabot[bot] Apr 1, 2024
ccfa26f
use secure random number generator (dart-lang/web_socket_channel#334)…
danielgrad Apr 4, 2024
01817d2
Create an adapter for `package:web_socket` (dart-lang/web_socket_chan…
brianquinlan Apr 8, 2024
510f396
Remove WebSocketChannel constructor (dart-lang/web_socket_channel#341)
brianquinlan Apr 8, 2024
c0ea76f
Implement IOWebSocketChannel as a WebSocketAdapterWebSocket subclass …
brianquinlan Apr 9, 2024
816e120
Rename WebSocketAdapterWebSocketChannel to AdapterWebSocketChannel (d…
brianquinlan Apr 9, 2024
d0940e6
Avoid importing io_web_socket namespace (dart-lang/web_socket_channel…
brianquinlan Apr 9, 2024
bf9965c
Fix a race when close() called before remote class event delivered (d…
brianquinlan Apr 26, 2024
e5b9efb
Bump dart-lang/setup-dart from 1.6.2 to 1.6.4 (dart-lang/web_socket_c…
dependabot[bot] May 1, 2024
0af8fbf
Bump actions/checkout from 4.1.2 to 4.1.4 (dart-lang/web_socket_chann…
dependabot[bot] May 1, 2024
c6af40c
Remove "wip" label for 3.0 release (dart-lang/web_socket_channel#347)
brianquinlan May 6, 2024
f84ac26
Make shelf_web_socket a dev dependency (dart-lang/web_socket_channel#…
brianquinlan May 6, 2024
d69a0b2
Remove dependency_overrides (dart-lang/web_socket_channel#354)
brianquinlan May 6, 2024
7739a5f
blast_repo fixes (dart-lang/web_socket_channel#359)
devoncarew May 13, 2024
9c7a42b
Bump actions/checkout from 4.1.4 to 4.1.5 in the github-actions group…
dependabot[bot] May 13, 2024
f7fd087
Remove obsolete `WebSocketChannel.new` documentation. (dart-lang/web_…
brianquinlan May 17, 2024
6ef94db
Bump and fix lints (dart-lang/web_socket_channel#366)
kevmoo May 22, 2024
1009766
Add `topics` to `pubspec.yaml` (dart-lang/web_socket_channel#362)
szakarias May 23, 2024
4e2d823
Remove `--fatal-infos` from `dart pub downgrade` analysis (dart-lang/…
brianquinlan May 23, 2024
6740e2f
Bump actions/checkout from 4.1.5 to 4.1.6 in the github-actions group…
dependabot[bot] Jun 2, 2024
e34a16e
bump web_socket dependency 0.1.3 -> 0.1.5 (dart-lang/web_socket_chann…
tempo-riz Jun 3, 2024
55ec98c
Bump the github-actions group with 2 updates (dart-lang/web_socket_ch…
dependabot[bot] Jul 1, 2024
1ab212a
Support latest pkg:web, prepare release (dart-lang/web_socket_channel…
kevmoo Jul 16, 2024
5570c4b
Bump actions/checkout from 4.1.7 to 4.2.0 in the github-actions group…
dependabot[bot] Oct 4, 2024
8564103
blast_repo fixes (dart-lang/web_socket_channel#385)
kevmoo Oct 30, 2024
1cfa990
Bump actions/checkout from 4.2.0 to 4.2.2 in the github-actions group…
dependabot[bot] Nov 1, 2024
2e21115
Bump dart-lang/setup-dart in the github-actions group (dart-lang/web_…
dependabot[bot] Dec 1, 2024
79db766
Merge package:web_socket_channel into the http monorepo
mosuem Dec 11, 2024
7bd6dfc
Add issue template and other fixes
mosuem Dec 11, 2024
1312034
Moving fixes
mosuem Dec 11, 2024
40a83eb
Merge branch 'master' into merge-web_socket_channel-package
mosuem Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/web_socket_channel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: "package:web_socket_channel"
about: "Create a bug or file a feature request against package:web_socket_channel."
labels: "package:web_socket_channel"
---
6 changes: 5 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
- changed-files:
- any-glob-to-any-file: 'pkgs/http_parser/**'

'package:web_socket_channel':
- changed-files:
- any-glob-to-any-file: 'pkgs/web_socket_channel/**'

'package:web_socket_conformance_tests':
- changed-files:
- any-glob-to-any-file: 'pkgs/web_socket_conformance_tests/**'
- any-glob-to-any-file: 'pkgs/http_client_conformance_tests/**'
80 changes: 80 additions & 0 deletions .github/workflows/web_socket_channel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: package:web_socket_channel

on:
push:
branches:
- master
paths:
- '.github/workflows/web_socket_channel.yaml'
- 'pkgs/web_socket_channel/**'
pull_request:
paths:
- '.github/workflows/web_socket_channel.yaml'
- 'pkgs/web_socket_channel/**'
schedule:
- cron: "0 0 * * 0"

defaults:
run:
working-directory: pkgs/web_socket_channel/

env:
PUB_ENVIRONMENT: bot.github

jobs:
# Check code formatting and static analysis on a single OS (linux)
# against Dart dev.
analyze:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: [dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
if: always() && steps.install.outcome == 'success'
- name: Analyze code
run: dart analyze
if: always() && steps.install.outcome == 'success'

test:
needs: analyze
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [3.3, dev]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
with:
sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
- name: Run VM tests
run: dart test --platform vm
if: always() && steps.install.outcome == 'success'
- name: Run Chrome tests
run: dart test --platform chrome
if: always() && steps.install.outcome == 'success'
- 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@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
- run: dart pub downgrade
- run: dart analyze
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and the browser.
| [http_profile](pkgs/http_profile/) | A library used by HTTP client authors to integrate with the DevTools Network View. | [![pub package](https://img.shields.io/pub/v/http_profile.svg)](https://pub.dev/packages/http_profile) |
| [ok_http](pkgs/ok_http/) | An Android Flutter plugin that provides access to the [OkHttp](https://square.github.io/okhttp/) HTTP client and the OkHttp [WebSocket](https://square.github.io/okhttp/5.x/okhttp/okhttp3/-web-socket/index.html) API. | [![pub package](https://img.shields.io/pub/v/ok_http.svg)](https://pub.dev/packages/ok_http) |
| [web_socket](pkgs/web_socket/) | Any easy-to-use library for communicating with WebSockets that has multiple implementations. | [![pub package](https://img.shields.io/pub/v/web_socket.svg)](https://pub.dev/packages/web_socket) |
| [web_socket_channel](pkgs/web_socket_channel/) | StreamChannel wrappers for WebSockets. Provides a cross-platform WebSocketChannel API. | [![package issues](https://img.shields.io/badge/package:web_socket_channel-4774bc)](https://github.com/dart-lang/tools/issues?q=is%3Aissue+is%3Aopen+label%3Apackage%3Aweb_socket_channel) | [![pub package](https://img.shields.io/pub/v/web_socket_channel.svg)](https://pub.dev/packages/web_socket_channel) |
| [web_socket_conformance_tests](pkgs/web_socket_conformance_tests/) | A library that tests whether implementations of `package:web_socket`'s `WebSocket` class behave as expected. | |

## Contributing
Expand Down
3 changes: 3 additions & 0 deletions pkgs/web_socket_channel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.dart_tool/
.packages
pubspec.lock
160 changes: 160 additions & 0 deletions pkgs/web_socket_channel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
## 3.0.2

- Move to `dart-lang/http` monorepo.

## 3.0.1

- Remove unnecessary `dependency_overrides`.
- Remove obsolete documentation for `WebSocketChannel.new`.
- Update package `web: '>=0.5.0 <2.0.0'`.

## 3.0.0

- Provide an adapter around `package:web_socket` `WebSocket`s and make it the
default implementation for `WebSocketChannel.connect`.
- **BREAKING**: Remove `WebSocketChannel` constructor.
- **BREAKING**: Make `WebSocketChannel` an `abstract interface`.
- **BREAKING**: `IOWebSocketChannel.ready` will throw
`WebSocketChannelException` instead of `WebSocketException`.

## 2.4.5

- use secure random number generator for frame masking.

## 2.4.4

- Require Dart `^3.3`
- Require `package:web` `^0.5.0`.

## 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

- 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`.
- Bump minimum Dart version to 3.2.0
- Move to `pkg:web` to support WebAssembly compilation.

## 2.4.0

- Add a `customClient` parameter to the `IOWebSocketChannel.connect` factory,
which allows the user to provide a custom `HttpClient` instance to use for the
WebSocket connection
- Bump minimum Dart version to 2.15.0

## 2.3.0

- Added a Future `ready` property to `WebSocketChannel`, which completes when
the connection is established
- Added a `connectTimeout` parameter to the `IOWebSocketChannel.connect` factory,
which controls the timeout of the WebSocket Future.
- Use platform agnostic code in README example.

## 2.2.0

- Add `HtmlWebSocketChannel.innerWebSocket` getter to access features not exposed
through the shared `WebSocketChannel` interface.

## 2.1.0

- Add `IOWebSocketChannel.innerWebSocket` getter to access features not exposed
through the shared `WebSocketChannel` interface.

## 2.0.0

- Support null safety.
- Require Dart 2.12.

## 1.2.0

* Add `protocols` argument to `WebSocketChannel.connect`. See the docs for
`WebSocket.connet`.
* Allow the latest crypto release (`3.x`).

## 1.1.0

* Add `WebSocketChannel.connect` factory constructor supporting platform
independent creation of WebSockets providing the lowest common denominator
of support on dart:io and dart:html.

## 1.0.15

* bug fix don't pass protocols parameter to WebSocket.

## 1.0.14

* Updates to handle `Socket implements Stream<Uint8List>`

## 1.0.13

* Internal changes for consistency with the Dart SDK.

## 1.0.12

* Allow `stream_channel` version 2.x

## 1.0.11

* Fixed description in pubspec.

* Fixed lints in README.md.

## 1.0.10

* Fixed links in README.md.

* Added an example.

* Fixed analysis lints that affected package score.

## 1.0.9

* Set max SDK version to `<3.0.0`.

## 1.0.8

* Remove use of deprecated constant name.

## 1.0.7

* Support the latest dev SDK.

## 1.0.6

* Declare support for `async` 2.0.0.

## 1.0.5

* Increase the SDK version constraint to `<2.0.0-dev.infinity`.

## 1.0.4

* Support `crypto` 2.0.0.

## 1.0.3

* Fix all strong-mode errors and warnings.

* Fix a bug where `HtmlWebSocketChannel.close()` would crash on non-Dartium
browsers if the close code and reason weren't provided explicitly.

## 1.0.2

* Properly use `BASE64` from `dart:convert` rather than `crypto`.

## 1.0.1

* Add support for `crypto` 1.0.0.

## 1.0.0

* Initial version
27 changes: 27 additions & 0 deletions pkgs/web_socket_channel/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright 2016, the Dart project authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
72 changes: 72 additions & 0 deletions pkgs/web_socket_channel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[![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)

`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`
class, and [a similar implementation][HtmlWebSocketChannel] that wraps
`dart:html`'s.

[stream_channel]: https://pub.dev/packages/stream_channel
[WebSocketChannel]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketChannel-class.html
[IOWebSocketChannel]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel.io/IOWebSocketChannel-class.html
[HtmlWebSocketChannel]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel.html/HtmlWebSocketChannel-class.html

It also provides constants for the WebSocket protocol's pre-defined status codes
in the [`status.dart` library][status]. It's strongly recommended that users
import this library with the prefix `status`.

[status]: https://pub.dev/documentation/web_socket_channel/latest/status/status-library.html

```dart
import 'package:web_socket_channel/web_socket_channel.dart';
import 'package:web_socket_channel/status.dart' as status;

main() async {
final wsUrl = Uri.parse('ws://example.com');
final channel = WebSocketChannel.connect(wsUrl);

await channel.ready;

channel.stream.listen((message) {
channel.sink.add('received!');
channel.sink.close(status.goingAway);
});
}
```

## `WebSocketChannel`

The [`WebSocketChannel`][WebSocketChannel] class's most important role is as the
interface for WebSocket stream channels across all implementations and all
platforms. In addition to the base `StreamChannel` interface, it adds a
[`protocol`][protocol] getter that returns the negotiated protocol for the
socket, as well as [`closeCode`][closeCode] and [`closeReason`][closeReason]
getters that provide information about why the socket closed.

[protocol]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketChannel/protocol.html
[closeCode]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketChannel/closeCode.html
[closeReason]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketChannel/closeReason.html

The channel's [`sink` property][sink] is also special. It returns a
[`WebSocketSink`][WebSocketSink], which is just like a `StreamSink` except that
its [`close()`][sink.close] method supports optional `closeCode` and
`closeReason` parameters. These parameters allow the caller to signal to the
other socket exactly why they're closing the connection.

[sink]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketChannel/sink.html
[WebSocketSink]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketSink-class.html
[sink.close]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketSink/close.html

`WebSocketChannel` also works as a cross-platform implementation of the
WebSocket protocol. The [`WebSocketChannel.connect` constructor][connect]
connects to a listening server using the appropriate implementation for the
platform.

[connect]: https://pub.dev/documentation/web_socket_channel/latest/web_socket_channel/WebSocketChannel/WebSocketChannel.connect.html
Loading
Loading