Index: sdk/lib/io/websocket.dart |
diff --git a/sdk/lib/io/websocket.dart b/sdk/lib/io/websocket.dart |
index 32dc9e065ea13c36c1a62fa3af7891edd9cc7d1a..a35ca3e5eb6852ee9698561b39c463d9e7230d6e 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); |
/** |
kasperl
2014/05/05 09:31:51
How bad would it be to add a (deprecated) default
Anders Johnsen
2014/05/05 09:33:49
Would it be okay if the WebSocket constructor thro
nweiz
2014/05/05 19:21:03
Wouldn't that also break users using "extend WebSo
|
+ * 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 `false`, the WebSocket will act as the client and mask |
+ * the messages it sends. If it's `true`, it will act as the server and will |
+ * not mask its messages. |
+ */ |
+ factory WebSocket.fromUpgradedSocket(Socket socket, {String protocol, |
+ bool serverSide: true}) => |
+ new _WebSocketImpl._fromSocket(socket, protocol, serverSide); |
+ |
+ /** |
* Returns the current state of the connection. |
*/ |
int get readyState; |