Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1224)

Unified Diff: sdk/lib/io/websocket.dart

Issue 839063005: Allow additional headers for WebSocket connect (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/io/websocket_impl.dart » ('j') | sdk/lib/io/websocket_impl.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.')
« no previous file with comments | « no previous file | sdk/lib/io/websocket_impl.dart » ('j') | sdk/lib/io/websocket_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698