Index: sdk/lib/io/websocket.dart |
diff --git a/sdk/lib/io/websocket.dart b/sdk/lib/io/websocket.dart |
index 327ef3aafff218300dd82a20dcf20ac8326d8305..5de7f13a4d1969d77074e0aa94ce88d78ed207aa 100644 |
--- a/sdk/lib/io/websocket.dart |
+++ b/sdk/lib/io/websocket.dart |
@@ -126,12 +126,30 @@ abstract class WebSocket implements Stream, StreamSink { |
/** |
* Create a new web socket connection. The URL supplied in [url] |
- * must use the scheme [:ws:] or [:wss:]. The [protocols] argument is |
- * specifying the subprotocols the client is willing to speak. |
+ * must use the scheme `ws` or `wss`. |
+ * |
+ * The [protocols] argument is specifying the subprotocols the |
+ * client is willing to speak. |
+ * |
+ * If [onRequest] is provided this function will be called with the |
Lasse Reichstein Nielsen
2015/01/12 15:11:56
I don't like the "onRequest" name. Its too vague.
Søren Gjesse
2015/01/12 15:36:34
Changed to pass a map of additional headers
|
+ * [HttpClientRequest] used to request the HTTP upgrade to the web |
+ * socket protocol just before the request is actually sent. Use |
+ * this if e.g. additional headers are required by the server. The |
Lasse Reichstein Nielsen
2015/01/12 15:11:56
Commas around "e.g.": "this if, e.g., additional".
Søren Gjesse
2015/01/12 15:36:34
Rephrased comment.
|
+ * following headers which are already set on the request should not |
+ * be changed. |
+ * |
+ * connection: Upgrade |
+ * sec-websocket-version: 13 |
+ * sec-websocket-key: ... |
+ * upgrade: websocket |
Lasse Reichstein Nielsen
2015/01/12 15:11:56
Then make sure they aren't. If it's only those fou
Søren Gjesse
2015/01/12 15:36:34
Changed to pass a map of additional headers, and d
|
+ * |
+ * If `onRequest` returns a `Future` the request is not sent until that |
+ * `Future` completes. |
*/ |
static Future<WebSocket> connect(String url, |
- {List<String> protocols: const []}) => |
- _WebSocketImpl.connect(url, protocols); |
+ {List<String> protocols: const [], |
Lasse Reichstein Nielsen
2015/01/12 15:11:56
Why is "protocols" a List and not an Iterable?
I c
Søren Gjesse
2015/01/12 15:36:34
No particular reason. Changed to Iterable.
|
+ Function onRequest}) => |
kustermann
2015/01/09 14:45:12
change the signature to this:
onRequest(HttpClien
Søren Gjesse
2015/01/12 15:36:34
Changed to not use callback.
|
+ _WebSocketImpl.connect(url, protocols, onRequest); |
@Deprecated('This constructor will be removed in Dart 2.0. Use `implements`' |
' instead of `extends` if implementing this abstract class.') |