From e6be78b9d0828eb35ae280dc24076445ed4f2ef5 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Wed, 7 Feb 2024 15:07:23 -0800 Subject: [PATCH 01/11] Create a SimpleWebSocket interface --- .github/workflows/dart.yml | 102 ++++++++++--- pkgs/simple_web_socket/CHANGELOG.md | 3 + pkgs/simple_web_socket/README.md | 2 + .../example/simple_web_socket_example.dart | 3 + .../lib/simple_web_socket.dart | 4 + .../lib/src/simple_web_socket.dart | 140 ++++++++++++++++++ pkgs/simple_web_socket/mono_pkg.yaml | 10 ++ pkgs/simple_web_socket/pubspec.yaml | 11 ++ 8 files changed, 254 insertions(+), 21 deletions(-) create mode 100644 pkgs/simple_web_socket/CHANGELOG.md create mode 100644 pkgs/simple_web_socket/README.md create mode 100644 pkgs/simple_web_socket/example/simple_web_socket_example.dart create mode 100644 pkgs/simple_web_socket/lib/simple_web_socket.dart create mode 100644 pkgs/simple_web_socket/lib/src/simple_web_socket.dart create mode 100644 pkgs/simple_web_socket/mono_pkg.yaml create mode 100644 pkgs/simple_web_socket/pubspec.yaml diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 2f70d2bd93..03412e9c33 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -109,16 +109,46 @@ jobs: if: "always() && steps.pkgs_http_client_conformance_tests_pub_upgrade.conclusion == 'success'" working-directory: pkgs/http_client_conformance_tests job_004: - name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile; `dart analyze --fatal-infos`" + name: "analyze_and_format; linux; Dart 3.2.6; PKG: pkgs/simple_web_socket; `dart analyze --fatal-infos`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile;commands:analyze_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/simple_web_socket;commands:analyze_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile + os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/simple_web_socket + os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6 + os:ubuntu-latest;pub-cache-hosted + os:ubuntu-latest + - name: Setup Dart SDK + uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 + with: + sdk: "3.2.6" + - id: checkout + name: Checkout repository + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + - id: pkgs_simple_web_socket_pub_upgrade + name: pkgs/simple_web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/simple_web_socket + - name: "pkgs/simple_web_socket; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_simple_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/simple_web_socket + job_005: + name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/simple_web_socket; `dart analyze --fatal-infos`" + runs-on: ubuntu-latest + steps: + - name: Cache Pub hosted dependencies + uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 + with: + path: "~/.pub-cache/hosted" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/simple_web_socket;commands:analyze_1" + restore-keys: | + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/simple_web_socket os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -156,17 +186,26 @@ jobs: run: dart analyze --fatal-infos if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" working-directory: pkgs/http_profile - job_005: - name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile; `dart format --output=none --set-exit-if-changed .`" + - id: pkgs_simple_web_socket_pub_upgrade + name: pkgs/simple_web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/simple_web_socket + - name: "pkgs/simple_web_socket; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_simple_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/simple_web_socket + job_006: + name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/simple_web_socket; `dart format --output=none --set-exit-if-changed .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile;commands:format" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/simple_web_socket;commands:format" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/simple_web_socket os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -204,7 +243,16 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" working-directory: pkgs/http_profile - job_006: + - id: pkgs_simple_web_socket_pub_upgrade + name: pkgs/simple_web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/simple_web_socket + - name: "pkgs/simple_web_socket; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.pkgs_simple_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/simple_web_socket + job_007: name: "analyze_and_format; linux; Flutter stable; PKG: pkgs/flutter_http_example; `dart format --output=none --set-exit-if-changed .`" runs-on: ubuntu-latest steps: @@ -234,7 +282,7 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" working-directory: pkgs/flutter_http_example - job_007: + job_008: name: "analyze_and_format; linux; Flutter stable; PKG: pkgs/flutter_http_example; `flutter analyze --fatal-infos`" runs-on: ubuntu-latest steps: @@ -264,7 +312,7 @@ jobs: run: flutter analyze --fatal-infos if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" working-directory: pkgs/flutter_http_example - job_008: + job_009: name: "unit_test; linux; Dart 3.0.0; PKG: pkgs/http_profile; `dart test --platform vm`" runs-on: ubuntu-latest steps: @@ -302,7 +350,8 @@ jobs: - job_005 - job_006 - job_007 - job_009: + - job_008 + job_010: name: "unit_test; linux; Dart 3.2.0; PKG: pkgs/http; `dart run --define=no_default_http_client=true test/no_default_http_client_test.dart`" runs-on: ubuntu-latest steps: @@ -340,7 +389,8 @@ jobs: - job_005 - job_006 - job_007 - job_010: + - job_008 + job_011: name: "unit_test; linux; Dart 3.2.0; PKG: pkgs/http; `dart test --platform chrome`" runs-on: ubuntu-latest steps: @@ -378,7 +428,8 @@ jobs: - job_005 - job_006 - job_007 - job_011: + - job_008 + job_012: name: "unit_test; linux; Dart 3.2.0; PKG: pkgs/http; `dart test --platform vm`" runs-on: ubuntu-latest steps: @@ -416,7 +467,8 @@ jobs: - job_005 - job_006 - job_007 - job_012: + - job_008 + job_013: name: "unit_test; linux; Dart dev; PKG: pkgs/http; `dart run --define=no_default_http_client=true test/no_default_http_client_test.dart`" runs-on: ubuntu-latest steps: @@ -454,7 +506,8 @@ jobs: - job_005 - job_006 - job_007 - job_013: + - job_008 + job_014: name: "unit_test; linux; Dart dev; PKG: pkgs/http; `dart test --platform chrome`" runs-on: ubuntu-latest steps: @@ -492,7 +545,8 @@ jobs: - job_005 - job_006 - job_007 - job_014: + - job_008 + job_015: name: "unit_test; linux; Dart dev; PKGS: pkgs/http, pkgs/http_profile; `dart test --platform vm`" runs-on: ubuntu-latest steps: @@ -539,7 +593,8 @@ jobs: - job_005 - job_006 - job_007 - job_015: + - job_008 + job_016: name: "unit_test; linux; Dart dev; PKG: pkgs/http; `dart test --test-randomize-ordering-seed=random -p chrome -c dart2wasm`" runs-on: ubuntu-latest steps: @@ -577,7 +632,8 @@ jobs: - job_005 - job_006 - job_007 - job_016: + - job_008 + job_017: name: "unit_test; linux; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test --platform chrome`" runs-on: ubuntu-latest steps: @@ -615,7 +671,8 @@ jobs: - job_005 - job_006 - job_007 - job_017: + - job_008 + job_018: name: "unit_test; linux; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test`" runs-on: ubuntu-latest steps: @@ -653,7 +710,8 @@ jobs: - job_005 - job_006 - job_007 - job_018: + - job_008 + job_019: name: "unit_test; macos; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test`" runs-on: macos-latest steps: @@ -691,7 +749,8 @@ jobs: - job_005 - job_006 - job_007 - job_019: + - job_008 + job_020: name: "unit_test; windows; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test`" runs-on: windows-latest steps: @@ -719,3 +778,4 @@ jobs: - job_005 - job_006 - job_007 + - job_008 diff --git a/pkgs/simple_web_socket/CHANGELOG.md b/pkgs/simple_web_socket/CHANGELOG.md new file mode 100644 index 0000000000..6150eb23db --- /dev/null +++ b/pkgs/simple_web_socket/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +- Abstract interface definition. diff --git a/pkgs/simple_web_socket/README.md b/pkgs/simple_web_socket/README.md new file mode 100644 index 0000000000..e43843ebc9 --- /dev/null +++ b/pkgs/simple_web_socket/README.md @@ -0,0 +1,2 @@ +TODO: Put a short description of the package here that helps potential users +know whether this package might be useful for them. diff --git a/pkgs/simple_web_socket/example/simple_web_socket_example.dart b/pkgs/simple_web_socket/example/simple_web_socket_example.dart new file mode 100644 index 0000000000..6cb625c543 --- /dev/null +++ b/pkgs/simple_web_socket/example/simple_web_socket_example.dart @@ -0,0 +1,3 @@ +void main() { + // TODO: add an example. +} diff --git a/pkgs/simple_web_socket/lib/simple_web_socket.dart b/pkgs/simple_web_socket/lib/simple_web_socket.dart new file mode 100644 index 0000000000..fc4385a52b --- /dev/null +++ b/pkgs/simple_web_socket/lib/simple_web_socket.dart @@ -0,0 +1,4 @@ +/// TODO: write this doc string. +library; + +export 'src/simple_web_socket.dart'; diff --git a/pkgs/simple_web_socket/lib/src/simple_web_socket.dart b/pkgs/simple_web_socket/lib/src/simple_web_socket.dart new file mode 100644 index 0000000000..c0b2bcf31f --- /dev/null +++ b/pkgs/simple_web_socket/lib/src/simple_web_socket.dart @@ -0,0 +1,140 @@ +import 'dart:typed_data'; + +/// An event received from the peer through the [SimpleWebSocket]. +sealed class SimpleWebSocketEvent {} + +/// Text data received from the peer through the [SimpleWebSocket]. +/// +/// See [SimpleWebSocket.events]. +final class TextDataReceived extends SimpleWebSocketEvent { + final String text; + TextDataReceived(this.text); + + @override + bool operator ==(Object other) => + other is TextDataReceived && other.text == text; + + @override + int get hashCode => text.hashCode; +} + +/// Binary data received from the peer through the [SimpleWebSocket]. +/// +/// See [SimpleWebSocket.events]. +final class BinaryDataReceived extends SimpleWebSocketEvent { + final Uint8List data; + BinaryDataReceived(this.data); + + @override + bool operator ==(Object other) { + if (other is BinaryDataReceived && other.data.length == data.length) { + for (var i = 0; i < data.length; ++i) { + if (other.data[i] != data[i]) return false; + } + return true; + } + return false; + } + + @override + int get hashCode => data.hashCode; + + @override + String toString() => 'BinaryDataReceived($data)'; +} + +/// A close notification (Close frame) received from the peer through the +/// [SimpleWebSocket] or a failure indication. +/// +/// See [SimpleWebSocket.events]. +final class CloseReceived extends SimpleWebSocketEvent { + /// A numerical code indicating the reason why the WebSocket was closed. + /// + /// See [RFC-6455 7.4](https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4) + /// for guidance on how to interpret these codes. + final int? code; + + /// A textual explanation of the reason why the WebSocket was closed. + /// + /// Will be empty if the peer did not specify a reason. + final String reason; + + CloseReceived([this.code, this.reason = ""]); + + @override + bool operator ==(Object other) => + other is CloseReceived && other.code == code && other.reason == reason; + + @override + int get hashCode => [code, reason].hashCode; + + @override + String toString() => 'CloseReceived($code, $reason)'; +} + +class SimpleWebSocketException implements Exception { + final String message; + SimpleWebSocketException([this.message = ""]); +} + +/// Thrown if [SimpleWebSocket.sendText], [SimpleWebSocket.sendBytes], or +/// [SimpleWebSocket.close] is called when the [SimpleWebSocket] is closed. +class SimpleWebSocketConnectionClosed extends SimpleWebSocketException { + SimpleWebSocketConnectionClosed([super.message = 'Connection Closed']); +} + +/// The interface for WebSocket connections. +/// +/// TODO: insert a usage example. +abstract interface class SimpleWebSocket { + /// Sends text data to the connected peer. + /// + /// Throws [SimpleWebSocketConnectionClosed] if the [SimpleWebSocket] is + /// closed (either through [close] or by the peer). + void sendText(String s); + + /// Sends binary data to the connected peer. + /// + /// Throws [SimpleWebSocketConnectionClosed] if the [SimpleWebSocket] is + /// closed (either through [close] or by the peer). + void sendBytes(Uint8List b); + + /// Closes the WebSocket connection and the [events] `Stream`. + /// + /// Sends a Close frame to the peer. If the optional [code] and [reason] + /// arguments are given, they will be included in the Close frame. If no + /// [code] is set then the peer will see a 1005 status code. If no [reason] + /// is set then the peer will not receive a reason string. + /// + /// Throws a [RangeError] if [code] is not in the range 3000-4999. + /// + /// Throws an [ArgumentError] if [reason] is longer than 123 bytes when + /// encoded as UTF-8 + /// + /// Throws [SimpleWebSocketConnectionClosed] if the connection is already + /// closed (including by the peer). + Future close([int? code, String? reason]); + + /// A [Stream] of [SimpleWebSocketEvent] received from the peer. + /// + /// Data received by the peer will be delivered as a [TextDataReceived] or + /// [BinaryDataReceived]. + /// + /// If a [CloseReceived] event is received then the [Stream] will be closed. A + /// [CloseReceived] event indicates either that: + /// + /// - A close frame was received from the peer. [CloseReceived.code] and + /// [CloseReceived.reason] will be set by the peer. + /// - A failure occured (e.g. the peer disconnected). [CloseReceived.code] and + /// [CloseReceived.reason] will be a failure code defined by + /// (RFC-6455)[https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1] + /// (e.g. 1006). + /// + /// Errors will never appear in this [Stream]. + /// + /// TODO: we can't use a SynchronousStreamController here, right? It would be + /// cool if we deliver [CloseReceived] **before** the user sees write failures + /// because [events] is closed. In other languages, I'd use a callback so + /// ensure that the event is delivered immediately. + Stream get events; +} diff --git a/pkgs/simple_web_socket/mono_pkg.yaml b/pkgs/simple_web_socket/mono_pkg.yaml new file mode 100644 index 0000000000..16e4e7a5f3 --- /dev/null +++ b/pkgs/simple_web_socket/mono_pkg.yaml @@ -0,0 +1,10 @@ +sdk: +- pubspec +- dev + +stages: +- analyze_and_format: + - analyze: --fatal-infos + - format: + sdk: + - dev diff --git a/pkgs/simple_web_socket/pubspec.yaml b/pkgs/simple_web_socket/pubspec.yaml new file mode 100644 index 0000000000..3ad15e7740 --- /dev/null +++ b/pkgs/simple_web_socket/pubspec.yaml @@ -0,0 +1,11 @@ +name: simple_web_socket +description: "TODO: enter a descirption here" +version: 1.0.0 +repository: https://github.com/dart-lang/http/tree/master/pkgs/simple_web_socket + +environment: + sdk: ^3.2.6 + +dev_dependencies: + dart_flutter_team_lints: ^2.0.0 + test: ^1.24.0 From 41a06c317aafe4a50b347eb0a99fd75392fe61f3 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Wed, 7 Feb 2024 15:12:50 -0800 Subject: [PATCH 02/11] Update simple_web_socket.dart --- pkgs/simple_web_socket/lib/src/simple_web_socket.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/simple_web_socket/lib/src/simple_web_socket.dart b/pkgs/simple_web_socket/lib/src/simple_web_socket.dart index c0b2bcf31f..b2ec168c77 100644 --- a/pkgs/simple_web_socket/lib/src/simple_web_socket.dart +++ b/pkgs/simple_web_socket/lib/src/simple_web_socket.dart @@ -59,7 +59,7 @@ final class CloseReceived extends SimpleWebSocketEvent { /// Will be empty if the peer did not specify a reason. final String reason; - CloseReceived([this.code, this.reason = ""]); + CloseReceived([this.code, this.reason = '']); @override bool operator ==(Object other) => @@ -74,7 +74,7 @@ final class CloseReceived extends SimpleWebSocketEvent { class SimpleWebSocketException implements Exception { final String message; - SimpleWebSocketException([this.message = ""]); + SimpleWebSocketException([this.message = '']); } /// Thrown if [SimpleWebSocket.sendText], [SimpleWebSocket.sendBytes], or From 5630eeface82ddc17f72ab1e675c2decd057cedf Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Wed, 7 Feb 2024 15:27:08 -0800 Subject: [PATCH 03/11] Update simple_web_socket.dart --- pkgs/simple_web_socket/lib/src/simple_web_socket.dart | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkgs/simple_web_socket/lib/src/simple_web_socket.dart b/pkgs/simple_web_socket/lib/src/simple_web_socket.dart index b2ec168c77..158e262725 100644 --- a/pkgs/simple_web_socket/lib/src/simple_web_socket.dart +++ b/pkgs/simple_web_socket/lib/src/simple_web_socket.dart @@ -131,10 +131,5 @@ abstract interface class SimpleWebSocket { /// (e.g. 1006). /// /// Errors will never appear in this [Stream]. - /// - /// TODO: we can't use a SynchronousStreamController here, right? It would be - /// cool if we deliver [CloseReceived] **before** the user sees write failures - /// because [events] is closed. In other languages, I'd use a callback so - /// ensure that the event is delivered immediately. Stream get events; } From fb5e9103fa98304ffbd4cfb4e296510314113d58 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Wed, 7 Feb 2024 15:59:48 -0800 Subject: [PATCH 04/11] Rename --- .DS_Store | Bin 0 -> 6148 bytes pkgs/.DS_Store | Bin 0 -> 6148 bytes .../CHANGELOG.md | 0 .../README.md | 0 .../example/web_socket_example.dart} | 0 pkgs/web_socket/lib/.DS_Store | Bin 0 -> 6148 bytes .../lib/src/web_socket.dart} | 46 +++++++++--------- .../lib/web_socket.dart} | 0 .../mono_pkg.yaml | 0 .../pubspec.yaml | 4 +- 10 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 .DS_Store create mode 100644 pkgs/.DS_Store rename pkgs/{simple_web_socket => web_socket}/CHANGELOG.md (100%) rename pkgs/{simple_web_socket => web_socket}/README.md (100%) rename pkgs/{simple_web_socket/example/simple_web_socket_example.dart => web_socket/example/web_socket_example.dart} (100%) create mode 100644 pkgs/web_socket/lib/.DS_Store rename pkgs/{simple_web_socket/lib/src/simple_web_socket.dart => web_socket/lib/src/web_socket.dart} (70%) rename pkgs/{simple_web_socket/lib/simple_web_socket.dart => web_socket/lib/web_socket.dart} (100%) rename pkgs/{simple_web_socket => web_socket}/mono_pkg.yaml (100%) rename pkgs/{simple_web_socket => web_socket}/pubspec.yaml (60%) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..6ad39d502ece5bc8e5e52f31ea8a2c6ff6d6e2f6 GIT binary patch literal 6148 zcmeHK%}T>S5Z-O0O({YS3Oz1(Em%zz#7l_v1&ruHr6#1*(3mYvY7eE5v%Zi|;`2DO zyAg}^Dq?3~_nY6{><8H&#u)c!@gZXlW6Xwz$Wd7%=w2JDnPfzcV?^_O5~VT%`_07u zI^efkY{JHD#PYA-A5GFEFS^}#UaMPM+YP&6x9t1iQO<)REM~bMPH)k=k}{1dJ&dlC z;e6oip3AHVlWaIu1xY-Fl)IZGi{;#xvnK|n+F43-+z)&U(}pD}JBqJWNX2}EJgGgxYb2ng4ufVz~M zCkEH$;1?#(GgxZW<&3MDVH`7a^?2cGcJK?8&bX(MdSZYWSY@EDO$X2a3;1Q$KJr&f z$RY-afq%vTxB5ZfheesQ_1p6BtQF86prK%1i3$klE0+K;a35)_ppFaFA5{Ceh=It&95M94gB)$J zl&u4r0nNaFV}SPVHlz^25JvEM|9TkZ@Bjnc%~_DAqafzAtKWiA9Hm*i{m#}Z#`;Fp zteSQ6&VAy!oB7!!b^P%SeO+=M2Xo&KuA+YKHFnN;lKD~6AB%!0>|@I9b(DlWclaa; zQ&H>60kdY-yhd|6?RGjXt9#U$wXEsMVH^F<@oZKzclY*BFT6oKO!$kWmf=YxWJ}>3 zUeWnMr_b&#U;v=tT-aRi0QQbbwG)Dwfra*SIl&sJDSl;yz0$~cc& znW+~F6RTs~66wHfiP~xgGy{taRODxa?*H@e-~Wq6`b#sQ87LJ4%;>p22U}8i>r!)c v*IKCes3eqENE9V#)O9Qzx{8~qLU7C?2hmnoNW=(={t*x~XrmeUQwBZ&S>2Pz literal 0 HcmV?d00001 diff --git a/pkgs/simple_web_socket/CHANGELOG.md b/pkgs/web_socket/CHANGELOG.md similarity index 100% rename from pkgs/simple_web_socket/CHANGELOG.md rename to pkgs/web_socket/CHANGELOG.md diff --git a/pkgs/simple_web_socket/README.md b/pkgs/web_socket/README.md similarity index 100% rename from pkgs/simple_web_socket/README.md rename to pkgs/web_socket/README.md diff --git a/pkgs/simple_web_socket/example/simple_web_socket_example.dart b/pkgs/web_socket/example/web_socket_example.dart similarity index 100% rename from pkgs/simple_web_socket/example/simple_web_socket_example.dart rename to pkgs/web_socket/example/web_socket_example.dart diff --git a/pkgs/web_socket/lib/.DS_Store b/pkgs/web_socket/lib/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d870d2cec6a0bd64920bf499d989f1761cd9ee87 GIT binary patch literal 6148 zcmeHK%}T>S5Z<-brW7Fug&r5Y7ObWU;w8lT0!H+pQWH}&7_%iw&7l->))(?gd>&_Z zH()Vm5jz9B-~8@oKgj+t#<(|+4j8i;V-_?-j!J`|yD_w3k`XzMkd=+=*U?P#Ny;|2)c8; zTz0M9z5UaR$#e3O$~R3X2ey@L8?50S6tkLFKT8vtK7yytuCoY<0b+m{AO_Z(0dp=` zz4fMnR! z<=_`4&ox+S)a8t;nPD6=bNzVXYIg7omCm@Uk$Pf)7+7VXrA-^p|8w|d8Xx(qC1eo; z#K1pefVao~*n>rxv-QXF@T?Wk?xCSzUWEz>=qr~1FmNB~tDuex)FIC`SZTyj(67n? P=^~&Ap^g~%1qQwV0LV#$ literal 0 HcmV?d00001 diff --git a/pkgs/simple_web_socket/lib/src/simple_web_socket.dart b/pkgs/web_socket/lib/src/web_socket.dart similarity index 70% rename from pkgs/simple_web_socket/lib/src/simple_web_socket.dart rename to pkgs/web_socket/lib/src/web_socket.dart index 158e262725..f712957fa2 100644 --- a/pkgs/simple_web_socket/lib/src/simple_web_socket.dart +++ b/pkgs/web_socket/lib/src/web_socket.dart @@ -1,12 +1,12 @@ import 'dart:typed_data'; -/// An event received from the peer through the [SimpleWebSocket]. -sealed class SimpleWebSocketEvent {} +/// An event received from the peer through the [WebSocket]. +sealed class WebSocketEvent {} -/// Text data received from the peer through the [SimpleWebSocket]. +/// Text data received from the peer through the [WebSocket]. /// -/// See [SimpleWebSocket.events]. -final class TextDataReceived extends SimpleWebSocketEvent { +/// See [WebSocket.events]. +final class TextDataReceived extends WebSocketEvent { final String text; TextDataReceived(this.text); @@ -18,10 +18,10 @@ final class TextDataReceived extends SimpleWebSocketEvent { int get hashCode => text.hashCode; } -/// Binary data received from the peer through the [SimpleWebSocket]. +/// Binary data received from the peer through the [WebSocket]. /// -/// See [SimpleWebSocket.events]. -final class BinaryDataReceived extends SimpleWebSocketEvent { +/// See [WebSocket.events]. +final class BinaryDataReceived extends WebSocketEvent { final Uint8List data; BinaryDataReceived(this.data); @@ -44,10 +44,10 @@ final class BinaryDataReceived extends SimpleWebSocketEvent { } /// A close notification (Close frame) received from the peer through the -/// [SimpleWebSocket] or a failure indication. +/// [WebSocket] or a failure indication. /// -/// See [SimpleWebSocket.events]. -final class CloseReceived extends SimpleWebSocketEvent { +/// See [WebSocket.events]. +final class CloseReceived extends WebSocketEvent { /// A numerical code indicating the reason why the WebSocket was closed. /// /// See [RFC-6455 7.4](https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4) @@ -72,30 +72,30 @@ final class CloseReceived extends SimpleWebSocketEvent { String toString() => 'CloseReceived($code, $reason)'; } -class SimpleWebSocketException implements Exception { +class WebSocketException implements Exception { final String message; - SimpleWebSocketException([this.message = '']); + WebSocketException([this.message = '']); } -/// Thrown if [SimpleWebSocket.sendText], [SimpleWebSocket.sendBytes], or -/// [SimpleWebSocket.close] is called when the [SimpleWebSocket] is closed. -class SimpleWebSocketConnectionClosed extends SimpleWebSocketException { - SimpleWebSocketConnectionClosed([super.message = 'Connection Closed']); +/// Thrown if [WebSocket.sendText], [WebSocket.sendBytes], or +/// [WebSocket.close] is called when the [WebSocket] is closed. +class WebSocketConnectionClosed extends WebSocketException { + WebSocketConnectionClosed([super.message = 'Connection Closed']); } /// The interface for WebSocket connections. /// /// TODO: insert a usage example. -abstract interface class SimpleWebSocket { +abstract interface class WebSocket { /// Sends text data to the connected peer. /// - /// Throws [SimpleWebSocketConnectionClosed] if the [SimpleWebSocket] is + /// Throws [WebSocketConnectionClosed] if the [WebSocket] is /// closed (either through [close] or by the peer). void sendText(String s); /// Sends binary data to the connected peer. /// - /// Throws [SimpleWebSocketConnectionClosed] if the [SimpleWebSocket] is + /// Throws [WebSocketConnectionClosed] if the [WebSocket] is /// closed (either through [close] or by the peer). void sendBytes(Uint8List b); @@ -111,11 +111,11 @@ abstract interface class SimpleWebSocket { /// Throws an [ArgumentError] if [reason] is longer than 123 bytes when /// encoded as UTF-8 /// - /// Throws [SimpleWebSocketConnectionClosed] if the connection is already + /// Throws [WebSocketConnectionClosed] if the connection is already /// closed (including by the peer). Future close([int? code, String? reason]); - /// A [Stream] of [SimpleWebSocketEvent] received from the peer. + /// A [Stream] of [WebSocketEvent] received from the peer. /// /// Data received by the peer will be delivered as a [TextDataReceived] or /// [BinaryDataReceived]. @@ -131,5 +131,5 @@ abstract interface class SimpleWebSocket { /// (e.g. 1006). /// /// Errors will never appear in this [Stream]. - Stream get events; + Stream get events; } diff --git a/pkgs/simple_web_socket/lib/simple_web_socket.dart b/pkgs/web_socket/lib/web_socket.dart similarity index 100% rename from pkgs/simple_web_socket/lib/simple_web_socket.dart rename to pkgs/web_socket/lib/web_socket.dart diff --git a/pkgs/simple_web_socket/mono_pkg.yaml b/pkgs/web_socket/mono_pkg.yaml similarity index 100% rename from pkgs/simple_web_socket/mono_pkg.yaml rename to pkgs/web_socket/mono_pkg.yaml diff --git a/pkgs/simple_web_socket/pubspec.yaml b/pkgs/web_socket/pubspec.yaml similarity index 60% rename from pkgs/simple_web_socket/pubspec.yaml rename to pkgs/web_socket/pubspec.yaml index 3ad15e7740..268ff8ea4d 100644 --- a/pkgs/simple_web_socket/pubspec.yaml +++ b/pkgs/web_socket/pubspec.yaml @@ -1,7 +1,7 @@ -name: simple_web_socket +name: web_socket description: "TODO: enter a descirption here" version: 1.0.0 -repository: https://github.com/dart-lang/http/tree/master/pkgs/simple_web_socket +repository: https://github.com/dart-lang/http/tree/master/pkgs/web_socket environment: sdk: ^3.2.6 From 4c2db09be90cc50980489863199772d5e540ed56 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Wed, 7 Feb 2024 16:02:17 -0800 Subject: [PATCH 05/11] Update dart.yml --- .github/workflows/dart.yml | 54 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 03412e9c33..e559ea8ba5 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -109,16 +109,16 @@ jobs: if: "always() && steps.pkgs_http_client_conformance_tests_pub_upgrade.conclusion == 'success'" working-directory: pkgs/http_client_conformance_tests job_004: - name: "analyze_and_format; linux; Dart 3.2.6; PKG: pkgs/simple_web_socket; `dart analyze --fatal-infos`" + name: "analyze_and_format; linux; Dart 3.2.6; PKG: pkgs/web_socket; `dart analyze --fatal-infos`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/simple_web_socket;commands:analyze_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/web_socket;commands:analyze_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/simple_web_socket + os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/web_socket os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -129,26 +129,26 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - id: pkgs_simple_web_socket_pub_upgrade - name: pkgs/simple_web_socket; dart pub upgrade + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/simple_web_socket - - name: "pkgs/simple_web_socket; dart analyze --fatal-infos" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart analyze --fatal-infos" run: dart analyze --fatal-infos - if: "always() && steps.pkgs_simple_web_socket_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/simple_web_socket + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket job_005: - name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/simple_web_socket; `dart analyze --fatal-infos`" + name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/web_socket; `dart analyze --fatal-infos`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/simple_web_socket;commands:analyze_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket;commands:analyze_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/simple_web_socket + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -186,26 +186,26 @@ jobs: run: dart analyze --fatal-infos if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" working-directory: pkgs/http_profile - - id: pkgs_simple_web_socket_pub_upgrade - name: pkgs/simple_web_socket; dart pub upgrade + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/simple_web_socket - - name: "pkgs/simple_web_socket; dart analyze --fatal-infos" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart analyze --fatal-infos" run: dart analyze --fatal-infos - if: "always() && steps.pkgs_simple_web_socket_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/simple_web_socket + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket job_006: - name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/simple_web_socket; `dart format --output=none --set-exit-if-changed .`" + name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/web_socket; `dart format --output=none --set-exit-if-changed .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/simple_web_socket;commands:format" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket;commands:format" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/simple_web_socket + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:pkgs/http-pkgs/http_client_conformance_tests-pkgs/http_profile-pkgs/web_socket os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -243,15 +243,15 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" working-directory: pkgs/http_profile - - id: pkgs_simple_web_socket_pub_upgrade - name: pkgs/simple_web_socket; dart pub upgrade + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/simple_web_socket - - name: "pkgs/simple_web_socket; dart format --output=none --set-exit-if-changed ." + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart format --output=none --set-exit-if-changed ." run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.pkgs_simple_web_socket_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/simple_web_socket + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket job_007: name: "analyze_and_format; linux; Flutter stable; PKG: pkgs/flutter_http_example; `dart format --output=none --set-exit-if-changed .`" runs-on: ubuntu-latest From 0bfacfaa625f89664dda90405be04f18f62c63d4 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Wed, 7 Feb 2024 17:52:06 -0800 Subject: [PATCH 06/11] Remove DS_STORE --- .DS_Store | Bin 6148 -> 0 bytes pkgs/.DS_Store | Bin 6148 -> 0 bytes pkgs/web_socket/lib/.DS_Store | Bin 6148 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store delete mode 100644 pkgs/.DS_Store delete mode 100644 pkgs/web_socket/lib/.DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 6ad39d502ece5bc8e5e52f31ea8a2c6ff6d6e2f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z-O0O({YS3Oz1(Em%zz#7l_v1&ruHr6#1*(3mYvY7eE5v%Zi|;`2DO zyAg}^Dq?3~_nY6{><8H&#u)c!@gZXlW6Xwz$Wd7%=w2JDnPfzcV?^_O5~VT%`_07u zI^efkY{JHD#PYA-A5GFEFS^}#UaMPM+YP&6x9t1iQO<)REM~bMPH)k=k}{1dJ&dlC z;e6oip3AHVlWaIu1xY-Fl)IZGi{;#xvnK|n+F43-+z)&U(}pD}JBqJWNX2}EJgGgxYb2ng4ufVz~M zCkEH$;1?#(GgxZW<&3MDVH`7a^?2cGcJK?8&bX(MdSZYWSY@EDO$X2a3;1Q$KJr&f z$RY-afq%vTxB5ZfheesQ_1p6BtQF86prK%1i3$klE0+K;a35)_ppFaFA5{Ceh=It&95M94gB)$J zl&u4r0nNaFV}SPVHlz^25JvEM|9TkZ@Bjnc%~_DAqafzAtKWiA9Hm*i{m#}Z#`;Fp zteSQ6&VAy!oB7!!b^P%SeO+=M2Xo&KuA+YKHFnN;lKD~6AB%!0>|@I9b(DlWclaa; zQ&H>60kdY-yhd|6?RGjXt9#U$wXEsMVH^F<@oZKzclY*BFT6oKO!$kWmf=YxWJ}>3 zUeWnMr_b&#U;v=tT-aRi0QQbbwG)Dwfra*SIl&sJDSl;yz0$~cc& znW+~F6RTs~66wHfiP~xgGy{taRODxa?*H@e-~Wq6`b#sQ87LJ4%;>p22U}8i>r!)c v*IKCes3eqENE9V#)O9Qzx{8~qLU7C?2hmnoNW=(={t*x~XrmeUQwBZ&S>2Pz diff --git a/pkgs/web_socket/lib/.DS_Store b/pkgs/web_socket/lib/.DS_Store deleted file mode 100644 index d870d2cec6a0bd64920bf499d989f1761cd9ee87..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z<-brW7Fug&r5Y7ObWU;w8lT0!H+pQWH}&7_%iw&7l->))(?gd>&_Z zH()Vm5jz9B-~8@oKgj+t#<(|+4j8i;V-_?-j!J`|yD_w3k`XzMkd=+=*U?P#Ny;|2)c8; zTz0M9z5UaR$#e3O$~R3X2ey@L8?50S6tkLFKT8vtK7yytuCoY<0b+m{AO_Z(0dp=` zz4fMnR! z<=_`4&ox+S)a8t;nPD6=bNzVXYIg7omCm@Uk$Pf)7+7VXrA-^p|8w|d8Xx(qC1eo; z#K1pefVao~*n>rxv-QXF@T?Wk?xCSzUWEz>=qr~1FmNB~tDuex)FIC`SZTyj(67n? P=^~&Ap^g~%1qQwV0LV#$ From 34eadaa2518a58d4a2952887ffba40380359a83b Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Wed, 7 Feb 2024 17:53:25 -0800 Subject: [PATCH 07/11] Update web_socket.dart --- pkgs/web_socket/lib/web_socket.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/web_socket/lib/web_socket.dart b/pkgs/web_socket/lib/web_socket.dart index fc4385a52b..b901ebc76a 100644 --- a/pkgs/web_socket/lib/web_socket.dart +++ b/pkgs/web_socket/lib/web_socket.dart @@ -1,4 +1,4 @@ /// TODO: write this doc string. library; -export 'src/simple_web_socket.dart'; +export 'src/web_socket.dart'; From ee8327f97e6127c7c70583f0f9853247105f3e4e Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Mon, 12 Feb 2024 15:44:28 -0800 Subject: [PATCH 08/11] Update pkgs/web_socket/CHANGELOG.md Co-authored-by: Nate Bosch --- pkgs/web_socket/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/web_socket/CHANGELOG.md b/pkgs/web_socket/CHANGELOG.md index 6150eb23db..3d138c0f6e 100644 --- a/pkgs/web_socket/CHANGELOG.md +++ b/pkgs/web_socket/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.0.1 +## 0.1.0-wip - Abstract interface definition. From 896c86689de8bebc2759b7b448e30c5bf24943dd Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Mon, 12 Feb 2024 15:44:36 -0800 Subject: [PATCH 09/11] Update pkgs/web_socket/pubspec.yaml Co-authored-by: Nate Bosch --- pkgs/web_socket/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/web_socket/pubspec.yaml b/pkgs/web_socket/pubspec.yaml index 268ff8ea4d..237da791ea 100644 --- a/pkgs/web_socket/pubspec.yaml +++ b/pkgs/web_socket/pubspec.yaml @@ -1,6 +1,6 @@ name: web_socket description: "TODO: enter a descirption here" -version: 1.0.0 +publish_to: none repository: https://github.com/dart-lang/http/tree/master/pkgs/web_socket environment: From 6c43b9561186b589b143810f9ffff502276ef9e1 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Mon, 12 Feb 2024 15:51:41 -0800 Subject: [PATCH 10/11] Update web_socket.dart --- pkgs/web_socket/lib/src/web_socket.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/web_socket/lib/src/web_socket.dart b/pkgs/web_socket/lib/src/web_socket.dart index f712957fa2..ffc0a3844c 100644 --- a/pkgs/web_socket/lib/src/web_socket.dart +++ b/pkgs/web_socket/lib/src/web_socket.dart @@ -91,12 +91,18 @@ abstract interface class WebSocket { /// /// Throws [WebSocketConnectionClosed] if the [WebSocket] is /// closed (either through [close] or by the peer). + /// + /// Data sent through [sendText] will be silently discarded if the peer is + /// disconnected but the disconnect has not yet been detected. void sendText(String s); /// Sends binary data to the connected peer. /// /// Throws [WebSocketConnectionClosed] if the [WebSocket] is /// closed (either through [close] or by the peer). + /// + /// Data sent through [sendBytes] will be silently discarded if the peer is + /// disconnected but the disconnect has not yet been detected. void sendBytes(Uint8List b); /// Closes the WebSocket connection and the [events] `Stream`. From 5a03e39681a409f56ce866390540a7d24782d56e Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Tue, 20 Feb 2024 12:51:21 -0800 Subject: [PATCH 11/11] Update dart.yml --- .github/workflows/dart.yml | 110 +++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 40 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index afe622abbf..22c1e5205c 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -100,66 +100,66 @@ jobs: if: "always() && steps.pkgs_http_client_conformance_tests_pub_upgrade.conclusion == 'success'" working-directory: pkgs/http_client_conformance_tests job_004: - name: "analyze_and_format; linux; Dart 3.3.0; PKG: pkgs/http; `dart analyze --fatal-infos`" + name: "analyze_and_format; linux; Dart 3.2.6; PKG: pkgs/web_socket; `dart analyze --fatal-infos`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:pkgs/http;commands:analyze_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/web_socket;commands:analyze_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:pkgs/http - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/web_socket + os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: - sdk: "3.3.0" + sdk: "3.2.6" - id: checkout name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - id: pkgs_http_pub_upgrade - name: pkgs/http; dart pub upgrade + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/http - - name: "pkgs/http; dart analyze --fatal-infos" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart analyze --fatal-infos" run: dart analyze --fatal-infos - if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/http + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket job_005: - name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile; `dart analyze --fatal-infos`" + name: "analyze_and_format; linux; Dart 3.3.0; PKG: pkgs/http; `dart analyze --fatal-infos`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/web_socket;commands:analyze_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:pkgs/http;commands:analyze_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6;packages:pkgs/web_socket - os:ubuntu-latest;pub-cache-hosted;sdk:3.2.6 + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:pkgs/http + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 with: - sdk: "3.2.6" + sdk: "3.3.0" - id: checkout name: Checkout repository - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - - id: pkgs_web_socket_pub_upgrade - name: pkgs/web_socket; dart pub upgrade + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - id: pkgs_http_pub_upgrade + name: pkgs/http; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: pkgs/web_socket - - name: "pkgs/web_socket; dart analyze --fatal-infos" + working-directory: pkgs/http + - name: "pkgs/http; dart analyze --fatal-infos" run: dart analyze --fatal-infos - if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" - working-directory: pkgs/web_socket - job_005: + if: "always() && steps.pkgs_http_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/http + job_006: name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/web_socket; `dart analyze --fatal-infos`" runs-on: ubuntu-latest steps: @@ -207,8 +207,17 @@ jobs: run: dart analyze --fatal-infos if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" working-directory: pkgs/http_profile - job_006: - name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile; `dart format --output=none --set-exit-if-changed .`" + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart analyze --fatal-infos" + run: dart analyze --fatal-infos + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket + job_007: + name: "analyze_and_format; linux; Dart dev; PKGS: pkgs/http, pkgs/http_client_conformance_tests, pkgs/http_profile, pkgs/web_socket; `dart format --output=none --set-exit-if-changed .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies @@ -255,7 +264,16 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.pkgs_http_profile_pub_upgrade.conclusion == 'success'" working-directory: pkgs/http_profile - job_007: + - id: pkgs_web_socket_pub_upgrade + name: pkgs/web_socket; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: pkgs/web_socket + - name: "pkgs/web_socket; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.pkgs_web_socket_pub_upgrade.conclusion == 'success'" + working-directory: pkgs/web_socket + job_008: name: "analyze_and_format; linux; Flutter stable; PKG: pkgs/flutter_http_example; `dart format --output=none --set-exit-if-changed .`" runs-on: ubuntu-latest steps: @@ -285,7 +303,7 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" working-directory: pkgs/flutter_http_example - job_008: + job_009: name: "analyze_and_format; linux; Flutter stable; PKG: pkgs/flutter_http_example; `flutter analyze --fatal-infos`" runs-on: ubuntu-latest steps: @@ -315,7 +333,7 @@ jobs: run: flutter analyze --fatal-infos if: "always() && steps.pkgs_flutter_http_example_pub_upgrade.conclusion == 'success'" working-directory: pkgs/flutter_http_example - job_009: + job_010: name: "unit_test; linux; Dart 3.0.0; PKG: pkgs/http_profile; `dart test --platform vm`" runs-on: ubuntu-latest steps: @@ -354,7 +372,8 @@ jobs: - job_006 - job_007 - job_008 - job_010: + - job_009 + job_011: name: "unit_test; linux; Dart 3.3.0; PKG: pkgs/http; `dart run --define=no_default_http_client=true test/no_default_http_client_test.dart`" runs-on: ubuntu-latest steps: @@ -393,7 +412,8 @@ jobs: - job_006 - job_007 - job_008 - job_011: + - job_009 + job_012: name: "unit_test; linux; Dart 3.3.0; PKG: pkgs/http; `dart test --platform chrome`" runs-on: ubuntu-latest steps: @@ -432,7 +452,8 @@ jobs: - job_006 - job_007 - job_008 - job_012: + - job_009 + job_013: name: "unit_test; linux; Dart 3.3.0; PKG: pkgs/http; `dart test --platform vm`" runs-on: ubuntu-latest steps: @@ -471,7 +492,8 @@ jobs: - job_006 - job_007 - job_008 - job_013: + - job_009 + job_014: name: "unit_test; linux; Dart dev; PKG: pkgs/http; `dart run --define=no_default_http_client=true test/no_default_http_client_test.dart`" runs-on: ubuntu-latest steps: @@ -510,7 +532,8 @@ jobs: - job_006 - job_007 - job_008 - job_014: + - job_009 + job_015: name: "unit_test; linux; Dart dev; PKG: pkgs/http; `dart test --platform chrome`" runs-on: ubuntu-latest steps: @@ -549,7 +572,8 @@ jobs: - job_006 - job_007 - job_008 - job_015: + - job_009 + job_016: name: "unit_test; linux; Dart dev; PKGS: pkgs/http, pkgs/http_profile; `dart test --platform vm`" runs-on: ubuntu-latest steps: @@ -597,7 +621,8 @@ jobs: - job_006 - job_007 - job_008 - job_016: + - job_009 + job_017: name: "unit_test; linux; Dart dev; PKG: pkgs/http; `dart test --test-randomize-ordering-seed=random -p chrome -c dart2wasm`" runs-on: ubuntu-latest steps: @@ -636,7 +661,8 @@ jobs: - job_006 - job_007 - job_008 - job_017: + - job_009 + job_018: name: "unit_test; linux; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test --platform chrome`" runs-on: ubuntu-latest steps: @@ -675,7 +701,8 @@ jobs: - job_006 - job_007 - job_008 - job_018: + - job_009 + job_019: name: "unit_test; linux; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test`" runs-on: ubuntu-latest steps: @@ -714,7 +741,8 @@ jobs: - job_006 - job_007 - job_008 - job_019: + - job_009 + job_020: name: "unit_test; macos; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test`" runs-on: macos-latest steps: @@ -753,7 +781,8 @@ jobs: - job_006 - job_007 - job_008 - job_020: + - job_009 + job_021: name: "unit_test; windows; Flutter stable; PKG: pkgs/flutter_http_example; `flutter test`" runs-on: windows-latest steps: @@ -782,3 +811,4 @@ jobs: - job_006 - job_007 - job_008 + - job_009