| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * The web socket protocol is implemented by a HTTP server handler | 6 * The web socket protocol is implemented by a HTTP server handler |
| 7 * which can be instantiated like this: | 7 * which can be instantiated like this: |
| 8 * | 8 * |
| 9 * WebSocketHandler wsHandler = new WebSocketHandler(); | 9 * WebSocketHandler wsHandler = new WebSocketHandler(); |
| 10 * | 10 * |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 198 |
| 199 /** | 199 /** |
| 200 * Alternative web socket client interface. This interface is compliant | 200 * Alternative web socket client interface. This interface is compliant |
| 201 * with the W3C browser API for web sockets specified in | 201 * with the W3C browser API for web sockets specified in |
| 202 * http://dev.w3.org/html5/websockets/. | 202 * http://dev.w3.org/html5/websockets/. |
| 203 */ | 203 */ |
| 204 interface WebSocket default _WebSocket { | 204 interface WebSocket default _WebSocket { |
| 205 /** | 205 /** |
| 206 * Possible states of the connection. | 206 * Possible states of the connection. |
| 207 */ | 207 */ |
| 208 static final int CONNECTING = 0; | 208 static const int CONNECTING = 0; |
| 209 static final int OPEN = 1; | 209 static const int OPEN = 1; |
| 210 static final int CLOSING = 2; | 210 static const int CLOSING = 2; |
| 211 static final int CLOSED = 3; | 211 static const int CLOSED = 3; |
| 212 | 212 |
| 213 /** | 213 /** |
| 214 * Create a new web socket connection. The URL supplied in [url] | 214 * Create a new web socket connection. The URL supplied in [url] |
| 215 * must use the scheme [:ws:]. The [protocols] argument is either a | 215 * must use the scheme [:ws:]. The [protocols] argument is either a |
| 216 * [:String:] or [:List<String>:] specifying the subprotocols the | 216 * [:String:] or [:List<String>:] specifying the subprotocols the |
| 217 * client is willing to speak. | 217 * client is willing to speak. |
| 218 */ | 218 */ |
| 219 WebSocket(String url, [protocols]); | 219 WebSocket(String url, [protocols]); |
| 220 | 220 |
| 221 /** | 221 /** |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 */ | 278 */ |
| 279 void send(data); | 279 void send(data); |
| 280 } | 280 } |
| 281 | 281 |
| 282 | 282 |
| 283 class WebSocketException implements Exception { | 283 class WebSocketException implements Exception { |
| 284 const WebSocketException([String this.message = ""]); | 284 const WebSocketException([String this.message = ""]); |
| 285 String toString() => "WebSocketException: $message"; | 285 String toString() => "WebSocketException: $message"; |
| 286 final String message; | 286 final String message; |
| 287 } | 287 } |
| OLD | NEW |