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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 */ | 124 */ |
| 125 int get closeCode; | 125 int get closeCode; |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * The close reason set when the web socket connection is closed. If | 128 * The close reason set when the web socket connection is closed. If |
| 129 * there is no close reason available this property will be [:null:] | 129 * there is no close reason available this property will be [:null:] |
| 130 */ | 130 */ |
| 131 String get closeReason; | 131 String get closeReason; |
| 132 | 132 |
| 133 /** | 133 /** |
| 134 * Set and get the interval for sending ping signals. If a ping message is not | |
| 135 * answered, the `WebSocket` is assumed disconnected and the connection is | |
|
Søren Gjesse
2013/07/24 11:12:45
add "by a pong message from the peer" after answer
Anders Johnsen
2013/07/24 12:14:23
Done.
| |
| 136 * closed. When a ping signal is sent, the pong message must be received | |
|
Søren Gjesse
2013/07/24 11:12:45
Add information on the close status used.
Anders Johnsen
2013/07/24 12:14:23
Done.
| |
| 137 * within [pingInterval]. | |
| 138 * | |
| 139 * Set the [pingInterval] to `null` to disable sending ping messages. | |
| 140 * | |
| 141 * The default value is `null`. | |
| 142 */ | |
| 143 Duration pingInterval; | |
| 144 | |
| 145 /** | |
| 134 * Closes the web socket connection. Set the optional [code] and [reason] | 146 * Closes the web socket connection. Set the optional [code] and [reason] |
| 135 * arguments to send close information to the remote peer. If they are | 147 * arguments to send close information to the remote peer. If they are |
| 136 * omitted, the peer will see [WebSocketStatus.NO_STATUS_RECEIVED] code | 148 * omitted, the peer will see [WebSocketStatus.NO_STATUS_RECEIVED] code |
| 137 * with no reason. | 149 * with no reason. |
| 138 */ | 150 */ |
| 139 Future close([int code, String reason]); | 151 Future close([int code, String reason]); |
| 140 | 152 |
| 141 /** | 153 /** |
| 142 * Sends data on the web socket connection. The data in [data] must | 154 * Sends data on the web socket connection. The data in [data] must |
| 143 * be either a [:String:], or a [:List<int>:] holding bytes. | 155 * be either a [:String:], or a [:List<int>:] holding bytes. |
| 144 */ | 156 */ |
| 145 void add(data); | 157 void add(data); |
| 146 | 158 |
| 147 /** | 159 /** |
| 148 * Sends data from a stream on web socket connection. Each data event from | 160 * Sends data from a stream on web socket connection. Each data event from |
| 149 * [stream] will be send as a single WebSocket frame. The data from [stream] | 161 * [stream] will be send as a single WebSocket frame. The data from [stream] |
| 150 * must be either [:String:]s, or [:List<int>:]s holding bytes. | 162 * must be either [:String:]s, or [:List<int>:]s holding bytes. |
| 151 */ | 163 */ |
| 152 Future addStream(Stream stream); | 164 Future addStream(Stream stream); |
| 153 } | 165 } |
| 154 | 166 |
| 155 | 167 |
| 156 class WebSocketException implements IOException { | 168 class WebSocketException implements IOException { |
| 157 const WebSocketException([String this.message = ""]); | 169 const WebSocketException([String this.message = ""]); |
| 158 String toString() => "WebSocketException: $message"; | 170 String toString() => "WebSocketException: $message"; |
| 159 final String message; | 171 final String message; |
| 160 } | 172 } |
| OLD | NEW |