Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 /** |
| 137 * Creates a WebSocket from an existing socket. | |
|
Anders Johnsen
2014/04/29 10:43:44
[...] an already upgraded socket.
nweiz
2014/04/29 19:56:39
Done.
| |
| 138 * | |
| 139 * The initial WebSocket handshake must have occurred prior to this call. | |
|
Anders Johnsen
2014/04/29 10:43:44
This comment should be expanded to include referen
nweiz
2014/04/29 19:56:39
Done.
| |
| 140 * [protocol] should be the protocol negotiated by this handshake, if any. | |
|
Anders Johnsen
2014/04/29 10:43:44
protocol and serverSide should be in separate para
nweiz
2014/04/29 19:56:39
Done.
| |
| 141 * [serverSide] indicates whether this is a server socket or a client socket. | |
| 142 */ | |
| 143 factory WebSocket.fromSocket(Socket socket, {String protocol, | |
|
Anders Johnsen
2014/04/29 10:43:44
Please change the name to something along the line
nweiz
2014/04/29 19:56:39
Done.
| |
| 144 bool serverSide: true}) => | |
| 145 new _WebSocketImpl._fromSocket(socket, protocol, serverSide); | |
| 146 | |
| 147 /** | |
| 137 * Returns the current state of the connection. | 148 * Returns the current state of the connection. |
| 138 */ | 149 */ |
| 139 int get readyState; | 150 int get readyState; |
| 140 | 151 |
| 141 /** | 152 /** |
| 142 * The extensions property is initially the empty string. After the | 153 * The extensions property is initially the empty string. After the |
| 143 * web socket connection is established this string reflects the | 154 * web socket connection is established this string reflects the |
| 144 * extensions used by the server. | 155 * extensions used by the server. |
| 145 */ | 156 */ |
| 146 String get extensions; | 157 String get extensions; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 */ | 197 */ |
| 187 Future addStream(Stream stream); | 198 Future addStream(Stream stream); |
| 188 } | 199 } |
| 189 | 200 |
| 190 | 201 |
| 191 class WebSocketException implements IOException { | 202 class WebSocketException implements IOException { |
| 192 final String message; | 203 final String message; |
| 193 const WebSocketException([this.message = ""]); | 204 const WebSocketException([this.message = ""]); |
| 194 String toString() => "WebSocketException: $message"; | 205 String toString() => "WebSocketException: $message"; |
| 195 } | 206 } |
| OLD | NEW |