Use the web_socket_channel package.
R=kevmoo@google.com
Review URL: https://codereview.chromium.org//1758123002 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 06c4d4b..48ce8e9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+## 0.2.0
+
+* **Breaking change**: `webSocketHandler()` now uses the
+ [`WebSocketChannel`][WebSocketChannel] class defined in the
+ `web_socket_channel` package, rather than the deprecated class defined in
+ `http_parser`.
+
+[WebSocketChannel]: https://www.dartdocs.org/documentation/web_socket_channel/latest/web_socket_channel/WebSocketChannel-class.html
+
## 0.1.0
* **Breaking change**: `webSocketHandler()` now passes a
diff --git a/lib/shelf_web_socket.dart b/lib/shelf_web_socket.dart
index e233cce..3d376aa 100644
--- a/lib/shelf_web_socket.dart
+++ b/lib/shelf_web_socket.dart
@@ -2,8 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:http_parser/http_parser.dart';
import 'package:shelf/shelf.dart';
+import 'package:web_socket_channel/web_socket_channel.dart';
import 'src/web_socket_handler.dart';
diff --git a/lib/src/web_socket_handler.dart b/lib/src/web_socket_handler.dart
index c0e2c6f..b8f94a2 100644
--- a/lib/src/web_socket_handler.dart
+++ b/lib/src/web_socket_handler.dart
@@ -4,8 +4,8 @@
import 'dart:convert';
-import 'package:http_parser/http_parser.dart';
import 'package:shelf/shelf.dart';
+import 'package:web_socket_channel/web_socket_channel.dart';
/// A class that exposes a handler for upgrading WebSocket requests.
class WebSocketHandler {
@@ -70,7 +70,7 @@
"HTTP/1.1 101 Switching Protocols\r\n"
"Upgrade: websocket\r\n"
"Connection: Upgrade\r\n"
- "Sec-WebSocket-Accept: ${CompatibleWebSocket.signKey(key)}\r\n");
+ "Sec-WebSocket-Accept: ${WebSocketChannel.signKey(key)}\r\n");
if (protocol != null) sink.add("Sec-WebSocket-Protocol: $protocol\r\n");
sink.add("\r\n");
diff --git a/pubspec.yaml b/pubspec.yaml
index 5dff060..1306106 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,12 +1,12 @@
name: shelf_web_socket
-version: 0.1.0
+version: 0.2.0
author: "Dart Team <misc@dartlang.org>"
homepage: http://github.com/dart-lang/shelf_web_socket
description: >
A WebSocket handler for Shelf.
dependencies:
- http_parser: "^2.1.0"
shelf: ">=0.6.5 <0.8.0"
+ web_socket_channel: "^1.0.0"
dev_dependencies:
http: ">=0.10.0 <0.12.0"
test: "^0.12.0"