diff --git a/lib/html.dart b/lib/html.dart
index 5446b67..e36dab0 100644
--- a/lib/html.dart
+++ b/lib/html.dart
@@ -96,7 +96,7 @@ class HtmlWebSocketChannel extends StreamChannelMixin
}
// The socket API guarantees that only a single open event will be
// emitted.
- innerWebSocket.onOpen.first.then((_) {
+ innerWebSocket.onOpenX.first.then((_) {
_readyCompleter.complete();
_listen();
});
@@ -104,7 +104,7 @@ class HtmlWebSocketChannel extends StreamChannelMixin
// The socket API guarantees that only a single error event will be emitted,
// and that once it is no open or message events will be emitted.
- innerWebSocket.onError.first.then((_) {
+ innerWebSocket.onErrorX.first.then((_) {
// Unfortunately, the underlying WebSocket API doesn't expose any
// specific information about the error itself.
final error = WebSocketChannelException('WebSocket connection failed.');
@@ -115,11 +115,11 @@ class HtmlWebSocketChannel extends StreamChannelMixin
_controller.local.sink.close();
});
- innerWebSocket.onMessage.listen(_innerListen);
+ innerWebSocket.onMessageX.listen(_innerListen);
// The socket API guarantees that only a single error event will be emitted,
// and that once it is no other events will be emitted.
- innerWebSocket.onClose.first.then((event) {
+ innerWebSocket.onCloseX.first.then((event) {
_closeCode = event.code;
_closeReason = event.reason;
_controller.local.sink.close();
diff --git a/lib/src/web_helpers.dart b/lib/src/web_helpers.dart
index 7ef46e5..32b475a 100644
--- a/lib/src/web_helpers.dart
+++ b/lib/src/web_helpers.dart
@@ -7,11 +7,11 @@ import 'package:web/helpers.dart';
// TODO(kevmoo): remove when https://github.com/dart-lang/web/commit/4cb5811ed06
// is in a published release and the min constraint on pkg:web is updated
extension WebSocketEvents on WebSocket {
- Stream get onOpen => EventStreamProviders.openEvent.forTarget(this);
- Stream get onMessage =>
+ Stream get onOpenX => EventStreamProviders.openEvent.forTarget(this);
+ Stream get onMessageX =>
EventStreamProviders.messageEvent.forTarget(this);
- Stream get onClose =>
+ Stream get onCloseX =>
EventStreamProviders.closeEvent.forTarget(this);
- Stream get onError =>
+ Stream get onErrorX =>
EventStreamProviders.errorEventSourceEvent.forTarget(this);
}
diff --git a/test/html_test.dart b/test/html_test.dart
index 69f0cd9..908e370 100644
--- a/test/html_test.dart
+++ b/test/html_test.dart
@@ -70,7 +70,7 @@ void main() {
test('communicates using an existing open WebSocket', () async {
final webSocket = WebSocket('ws://localhost:$port');
- await webSocket.onOpen.first;
+ await webSocket.onOpenX.first;
final channel = HtmlWebSocketChannel(webSocket);