diff --git a/pkgs/web_socket/lib/src/browser_web_socket.dart b/pkgs/web_socket/lib/src/browser_web_socket.dart index a98afe9262..7fb61a9e33 100644 --- a/pkgs/web_socket/lib/src/browser_web_socket.dart +++ b/pkgs/web_socket/lib/src/browser_web_socket.dart @@ -18,6 +18,13 @@ class BrowserWebSocket implements WebSocket { final web.WebSocket _webSocket; final _events = StreamController(); + /// Create a new WebSocket connection using the JavaScript WebSocket API. + /// + /// The URL supplied in [url] must use the scheme ws or wss. + /// + /// If provided, the [protocols] argument indicates that subprotocols that + /// the peer is able to select. See + /// [RFC-6455 1.9](https://datatracker.ietf.org/doc/html/rfc6455#section-1.9). static Future connect(Uri url, {Iterable? protocols}) async { final webSocket = web.WebSocket(url.toString(), diff --git a/pkgs/web_socket/lib/src/io_web_socket.dart b/pkgs/web_socket/lib/src/io_web_socket.dart index ad345285d4..3d7da9f9fb 100644 --- a/pkgs/web_socket/lib/src/io_web_socket.dart +++ b/pkgs/web_socket/lib/src/io_web_socket.dart @@ -16,6 +16,13 @@ class IOWebSocket implements WebSocket { final io.WebSocket _webSocket; final _events = StreamController(); + /// Create a new WebSocket connection using dart:io WebSocket. + /// + /// The URL supplied in [url] must use the scheme ws or wss. + /// + /// If provided, the [protocols] argument indicates that subprotocols that + /// the peer is able to select. See + /// [RFC-6455 1.9](https://datatracker.ietf.org/doc/html/rfc6455#section-1.9). static Future connect(Uri url, {Iterable? protocols}) async { final io.WebSocket webSocket;