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 * WebSocket status codes used when closing a WebSocket connection. | 8 * WebSocket status codes used when closing a WebSocket connection. |
9 */ | 9 */ |
10 abstract class WebSocketStatus { | 10 abstract class WebSocketStatus { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 factory WebSocketTransformer( | 216 factory WebSocketTransformer( |
217 {/*String|Future<String>*/ protocolSelector(List<String> protocols), | 217 {/*String|Future<String>*/ protocolSelector(List<String> protocols), |
218 CompressionOptions compression: CompressionOptions.DEFAULT}) { | 218 CompressionOptions compression: CompressionOptions.DEFAULT}) { |
219 return new _WebSocketTransformerImpl(protocolSelector, compression); | 219 return new _WebSocketTransformerImpl(protocolSelector, compression); |
220 } | 220 } |
221 | 221 |
222 /** | 222 /** |
223 * Upgrades a [HttpRequest] to a [WebSocket] connection. If the | 223 * Upgrades a [HttpRequest] to a [WebSocket] connection. If the |
224 * request is not a valid WebSocket upgrade request an HTTP response | 224 * request is not a valid WebSocket upgrade request an HTTP response |
225 * with status code 500 will be returned. Otherwise the returned | 225 * with status code 500 will be returned. Otherwise the returned |
226 * future will complete with the [WebSocket] when the upgrade pocess | 226 * future will complete with the [WebSocket] when the upgrade process |
227 * is complete. | 227 * is complete. |
228 * | 228 * |
229 * If [protocolSelector] is provided, [protocolSelector] will be called to | 229 * If [protocolSelector] is provided, [protocolSelector] will be called to |
230 * select what protocol to use, if any were provided by the client. | 230 * select what protocol to use, if any were provided by the client. |
231 * [protocolSelector] is should return either a [String] or a [Future] | 231 * [protocolSelector] is should return either a [String] or a [Future] |
232 * completing with a [String]. The [String] must exist in the list of | 232 * completing with a [String]. The [String] must exist in the list of |
233 * protocols. | 233 * protocols. |
234 * | 234 * |
235 * If [compression] is provided, the [WebSocket] created will be configured | 235 * If [compression] is provided, the [WebSocket] created will be configured |
236 * to negotiate with the specified [CompressionOptions]. If none is specified | 236 * to negotiate with the specified [CompressionOptions]. If none is specified |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 void addUtf8Text(List<int> bytes); | 415 void addUtf8Text(List<int> bytes); |
416 } | 416 } |
417 | 417 |
418 class WebSocketException implements IOException { | 418 class WebSocketException implements IOException { |
419 final String message; | 419 final String message; |
420 | 420 |
421 const WebSocketException([this.message = ""]); | 421 const WebSocketException([this.message = ""]); |
422 | 422 |
423 String toString() => "WebSocketException: $message"; | 423 String toString() => "WebSocketException: $message"; |
424 } | 424 } |
OLD | NEW |