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

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

Issue 234323003: Make WebSocket.fromSocket public. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix test Created 6 years, 8 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 | tests/standalone/io/web_socket_test.dart » ('j') | no next file with comments »
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 32dc9e065ea13c36c1a62fa3af7891edd9cc7d1a..9d241254bf88656e312949c18273206590235848 100644
--- a/sdk/lib/io/websocket.dart
+++ b/sdk/lib/io/websocket.dart
@@ -134,6 +134,25 @@ abstract class WebSocket implements Stream, StreamSink {
_WebSocketImpl.connect(url, protocols);
/**
+ * Creates a WebSocket from an already-upgraded socket.
+ *
+ * The initial WebSocket handshake must have occurred prior to this call. A
+ * WebSocket client can automatically perform the handshake using
+ * [WebSocket.connect], while a server can do so using
+ * [WebSocketTransformer.upgrade]. To manually upgrade an [HttpRequest],
+ * [HttpRequest.detachSocket] may be called.
+ *
+ * [protocol] should be the protocol negotiated by this handshake, if any.
+ *
+ * If [serverSide] is `true`, the WebSocket will act as the server and mask
+ * the messages it sends. If it's `false`, it will act as the client and will
Anders Johnsen 2014/04/29 20:05:10 It's the other way around :)
nweiz 2014/04/30 22:33:27 Done.
+ * not mask its messages.
+ */
+ factory WebSocket.fromUpgradedSocket(Socket socket, {String protocol,
+ bool serverSide: true}) =>
Anders Johnsen 2014/04/29 20:05:10 Maybe serverSide should be a mandatory argument? T
nweiz 2014/04/30 22:33:27 It's good to encourage the user to consider, but I
Anders Johnsen 2014/05/01 04:58:12 That is a good argument - I sometimes forget the c
+ new _WebSocketImpl._fromSocket(socket, protocol, serverSide);
+
+ /**
* Returns the current state of the connection.
*/
int get readyState;
« no previous file with comments | « no previous file | tests/standalone/io/web_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698