Skip to content
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

Update the use of 'package:shelf_web_socket's webSocketHandler method #2421

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions pkgs/test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.25.11

* Update to be forward compatible with `package:shelf_web_socket` version `3.x`.

## 1.25.10

* Update the `package:vm_service` constraint to allow version `15.x`.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ import 'package:stream_channel/stream_channel.dart';
// returned spawnHybridCode().
hybridMain(StreamChannel channel) async {
// Start a WebSocket server that just sends "hello!" to its clients.
var server = await io.serve(webSocketHandler((webSocket) {
var server = await io.serve(webSocketHandler((webSocket, _) {
webSocket.sink.add('hello!');
}), 'localhost', 0);

Expand Down
7 changes: 6 additions & 1 deletion pkgs/test/lib/src/runner/browser/compilers/dart2js.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ class Dart2JsSupport extends CompilerSupport with JsHtmlWrapper {
@override
(Uri, Future<WebSocketChannel>) get webSocket {
var completer = Completer<WebSocketChannel>.sync();
var path = _webSocketHandler.create(webSocketHandler(completer.complete));
// Note: the WebSocketChannel type below is needed for compatibility with
// package:shelf_web_socket v2.
var path =
_webSocketHandler.create(webSocketHandler((WebSocketChannel ws, _) {
devoncarew marked this conversation as resolved.
Show resolved Hide resolved
completer.complete(ws);
}));
var webSocketUrl = serverUrl.replace(scheme: 'ws').resolve(path);
return (webSocketUrl, completer.future);
}
Expand Down
7 changes: 6 additions & 1 deletion pkgs/test/lib/src/runner/browser/compilers/dart2wasm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ class Dart2WasmSupport extends CompilerSupport with WasmHtmlWrapper {
@override
(Uri, Future<WebSocketChannel>) get webSocket {
var completer = Completer<WebSocketChannel>.sync();
var path = _webSocketHandler.create(webSocketHandler(completer.complete));
// Note: the WebSocketChannel type below is needed for compatibility with
// package:shelf_web_socket v2.
var path =
_webSocketHandler.create(webSocketHandler((WebSocketChannel ws, _) {
completer.complete(ws);
}));
var webSocketUrl = serverUrl.replace(scheme: 'ws').resolve(path);
return (webSocketUrl, completer.future);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ abstract class PrecompiledSupport extends CompilerSupport {
@override
(Uri, Future<WebSocketChannel>) get webSocket {
var completer = Completer<WebSocketChannel>.sync();
var path = _webSocketHandler.create(webSocketHandler(completer.complete));
// Note: the WebSocketChannel type below is needed for compatibility with
// package:shelf_web_socket v2.
var path =
_webSocketHandler.create(webSocketHandler((WebSocketChannel ws, _) {
completer.complete(ws);
}));
var webSocketUrl = serverUrl.replace(scheme: 'ws').resolve(path);
return (webSocketUrl, completer.future);
}
Expand Down
2 changes: 1 addition & 1 deletion pkgs/test/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: test
version: 1.25.10
version: 1.25.11
description: >-
A full featured library for writing and running Dart tests across platforms.
repository: https://github.com/dart-lang/test/tree/master/pkgs/test
Expand Down
6 changes: 5 additions & 1 deletion pkgs/test/test/runner/browser/code_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ class CodeServer {
/// future that will complete to the WebSocket.
Future<WebSocketChannel> handleWebSocket() {
var completer = Completer<WebSocketChannel>();
_handler.expect('GET', '/', webSocketHandler(completer.complete));
// Note: the WebSocketChannel type below is needed for compatibility with
// package:shelf_web_socket v2.
_handler.expect('GET', '/', webSocketHandler((WebSocketChannel ws, _) {
completer.complete(ws);
}));
return completer.future;
}
}
Expand Down
Loading