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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 * be either a `String`, or a `List<int>` holding bytes. | 395 * be either a `String`, or a `List<int>` holding bytes. |
396 */ | 396 */ |
397 void add(/*String|List<int>*/ data); | 397 void add(/*String|List<int>*/ data); |
398 | 398 |
399 /** | 399 /** |
400 * Sends data from a stream on WebSocket connection. Each data event from | 400 * Sends data from a stream on WebSocket connection. Each data event from |
401 * [stream] will be send as a single WebSocket frame. The data from [stream] | 401 * [stream] will be send as a single WebSocket frame. The data from [stream] |
402 * must be either `String`s, or `List<int>`s holding bytes. | 402 * must be either `String`s, or `List<int>`s holding bytes. |
403 */ | 403 */ |
404 Future addStream(Stream stream); | 404 Future addStream(Stream stream); |
| 405 |
| 406 /** |
| 407 * Sends a text message with the text represented by [bytes]. |
| 408 * |
| 409 * The [bytes] should be valid UTF-8 encoded Unicode characters. If they are |
| 410 * not, the receiving end will close the connection. |
| 411 */ |
| 412 void addUtf8Text(List<int> bytes); |
405 } | 413 } |
406 | 414 |
407 class WebSocketException implements IOException { | 415 class WebSocketException implements IOException { |
408 final String message; | 416 final String message; |
409 | 417 |
410 const WebSocketException([this.message = ""]); | 418 const WebSocketException([this.message = ""]); |
411 | 419 |
412 String toString() => "WebSocketException: $message"; | 420 String toString() => "WebSocketException: $message"; |
413 } | 421 } |
OLD | NEW |