Require Uri.
diff --git a/lib/src/_connect_api.dart b/lib/src/_connect_api.dart
index 13d22eb..93c6ce7 100644
--- a/lib/src/_connect_api.dart
+++ b/lib/src/_connect_api.dart
@@ -6,9 +6,8 @@
/// Creates a new WebSocket connection.
///
-/// Connects to [url] using and returns a channel that can be used to
-/// communicate over the resulting socket. The [url] may be either a [String]
-/// or a [Uri].
-WebSocketChannel connect(String url) {
+/// Connects to [uri] using and returns a channel that can be used to
+/// communicate over the resulting socket.
+WebSocketChannel connect(Uri uri) {
throw UnsupportedError('No implementation of the connect api provided');
}
diff --git a/lib/src/_connect_html.dart b/lib/src/_connect_html.dart
index d8e5ec7..3c36641 100644
--- a/lib/src/_connect_html.dart
+++ b/lib/src/_connect_html.dart
@@ -8,7 +8,6 @@
/// Creates a new WebSocket connection.
///
-/// Connects to [url] using and returns a channel that can be used to
-/// communicate over the resulting socket. The [url] may be either a [String]
-/// or a [Uri].
-WebSocketChannel connect(url) => HtmlWebSocketChannel.connect(url);
+/// Connects to [uri] using and returns a channel that can be used to
+/// communicate over the resulting socket.
+WebSocketChannel connect(Uri uri) => HtmlWebSocketChannel.connect(uri);
diff --git a/lib/src/_connect_io.dart b/lib/src/_connect_io.dart
index 80d362d..b788926 100644
--- a/lib/src/_connect_io.dart
+++ b/lib/src/_connect_io.dart
@@ -7,7 +7,6 @@
/// Creates a new WebSocket connection.
///
-/// Connects to [url] using and returns a channel that can be used to
-/// communicate over the resulting socket. The [url] may be either a [String]
-/// or a [Uri].
-WebSocketChannel connect(url) => IOWebSocketChannel.connect(url);
+/// Connects to [uri] using and returns a channel that can be used to
+/// communicate over the resulting socket
+WebSocketChannel connect(Uri uri) => IOWebSocketChannel.connect(uri);
diff --git a/lib/src/channel.dart b/lib/src/channel.dart
index 6bbb3c4..cee27f2 100644
--- a/lib/src/channel.dart
+++ b/lib/src/channel.dart
@@ -101,10 +101,9 @@
/// Creates a new WebSocket connection.
///
- /// Connects to [url] using and returns a channel that can be used to
- /// communicate over the resulting socket. The [url] may be either a [String]
- /// or a [Uri].
- factory WebSocketChannel.connect(url) => platform.connect(url);
+ /// Connects to [uri] using and returns a channel that can be used to
+ /// communicate over the resulting socket.
+ factory WebSocketChannel.connect(Uri uri) => platform.connect(uri);
}
/// The sink exposed by a [WebSocketChannel].
diff --git a/test/html_test.dart b/test/html_test.dart
index 75aacfb..b05c8ec 100644
--- a/test/html_test.dart
+++ b/test/html_test.dart
@@ -81,7 +81,7 @@
test(".connect defaults to binary lists using platform independent api",
() async {
- channel = WebSocketChannel.connect("ws://localhost:$port");
+ channel = WebSocketChannel.connect(Uri.parse("ws://localhost:$port"));
var queue = StreamQueue(channel.stream);
channel.sink.add("foo");
diff --git a/test/io_test.dart b/test/io_test.dart
index b389699..4d4b1a9 100644
--- a/test/io_test.dart
+++ b/test/io_test.dart
@@ -81,7 +81,8 @@
});
});
- var channel = WebSocketChannel.connect("ws://localhost:${server.port}");
+ var channel =
+ WebSocketChannel.connect(Uri.parse("ws://localhost:${server.port}"));
channel.sink.add("ping");
channel.stream.listen(