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

Side by Side 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: code review Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Web socket status codes used when closing a web socket connection. 8 * Web socket status codes used when closing a web socket connection.
9 */ 9 */
10 abstract class WebSocketStatus { 10 abstract class WebSocketStatus {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 /** 127 /**
128 * Create a new web socket connection. The URL supplied in [url] 128 * Create a new web socket connection. The URL supplied in [url]
129 * must use the scheme [:ws:] or [:wss:]. The [protocols] argument is 129 * must use the scheme [:ws:] or [:wss:]. The [protocols] argument is
130 * specifying the subprotocols the client is willing to speak. 130 * specifying the subprotocols the client is willing to speak.
131 */ 131 */
132 static Future<WebSocket> connect(String url, 132 static Future<WebSocket> connect(String url,
133 {List<String> protocols: const []}) => 133 {List<String> protocols: const []}) =>
134 _WebSocketImpl.connect(url, protocols); 134 _WebSocketImpl.connect(url, protocols);
135 135
136 /** 136 /**
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
137 * Creates a WebSocket from an already-upgraded socket.
138 *
139 * The initial WebSocket handshake must have occurred prior to this call. A
140 * WebSocket client can automatically perform the handshake using
141 * [WebSocket.connect], while a server can do so using
142 * [WebSocketTransformer.upgrade]. To manually upgrade an [HttpRequest],
143 * [HttpRequest.detachSocket] may be called.
144 *
145 * [protocol] should be the protocol negotiated by this handshake, if any.
146 *
147 * If [serverSide] is `false`, the WebSocket will act as the client and mask
148 * the messages it sends. If it's `true`, it will act as the server and will
149 * not mask its messages.
150 */
151 factory WebSocket.fromUpgradedSocket(Socket socket, {String protocol,
152 bool serverSide: true}) =>
153 new _WebSocketImpl._fromSocket(socket, protocol, serverSide);
154
155 /**
137 * Returns the current state of the connection. 156 * Returns the current state of the connection.
138 */ 157 */
139 int get readyState; 158 int get readyState;
140 159
141 /** 160 /**
142 * The extensions property is initially the empty string. After the 161 * The extensions property is initially the empty string. After the
143 * web socket connection is established this string reflects the 162 * web socket connection is established this string reflects the
144 * extensions used by the server. 163 * extensions used by the server.
145 */ 164 */
146 String get extensions; 165 String get extensions;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 */ 205 */
187 Future addStream(Stream stream); 206 Future addStream(Stream stream);
188 } 207 }
189 208
190 209
191 class WebSocketException implements IOException { 210 class WebSocketException implements IOException {
192 final String message; 211 final String message;
193 const WebSocketException([this.message = ""]); 212 const WebSocketException([this.message = ""]);
194 String toString() => "WebSocketException: $message"; 213 String toString() => "WebSocketException: $message";
195 } 214 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/web_socket_test.dart » ('j') | tests/standalone/io/web_socket_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698