Chromium Code Reviews| 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 * Web socket status codes used when closing a web socket connection. | 6 * Web socket status codes used when closing a web socket connection. |
| 7 */ | 7 */ |
| 8 abstract class WebSocketStatus { | 8 abstract class WebSocketStatus { |
| 9 static const int NORMAL_CLOSURE = 1000; | 9 static const int NORMAL_CLOSURE = 1000; |
| 10 static const int GOING_AWAY = 1001; | 10 static const int GOING_AWAY = 1001; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 * Sets the callback to be called when a new web socket connection | 50 * Sets the callback to be called when a new web socket connection |
| 51 * has been established. | 51 * has been established. |
| 52 */ | 52 */ |
| 53 void set onOpen(callback(WebSocketConnection connection)); | 53 void set onOpen(callback(WebSocketConnection connection)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * Server web socket connection. | 58 * Server web socket connection. |
| 59 */ | 59 */ |
| 60 abstract class WebSocketConnection implements Hashable { | 60 abstract class WebSocketConnection { |
|
Mads Ager (google)
2012/09/27 12:48:27
guess what. In the rest of the file as well.
| |
| 61 /** | 61 /** |
| 62 * Sets the callback to be called when a message have been | 62 * Sets the callback to be called when a message have been |
| 63 * received. The type on [message] is either [:String:] or | 63 * received. The type on [message] is either [:String:] or |
| 64 * [:List<int>:] depending on whether it is a text or binary | 64 * [:List<int>:] depending on whether it is a text or binary |
| 65 * message. If the message is empty [message] will be [:null:]. | 65 * message. If the message is empty [message] will be [:null:]. |
| 66 */ | 66 */ |
| 67 void set onMessage(void callback(message)); | 67 void set onMessage(void callback(message)); |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Sets the callback to be called when the web socket connection is | 70 * Sets the callback to be called when the web socket connection is |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 93 /** | 93 /** |
| 94 * WebSocketConnection is hashable. | 94 * WebSocketConnection is hashable. |
| 95 */ | 95 */ |
| 96 int hashCode(); | 96 int hashCode(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 /** | 100 /** |
| 101 * Client web socket connection. | 101 * Client web socket connection. |
| 102 */ | 102 */ |
| 103 abstract class WebSocketClientConnection implements Hashable { | 103 abstract class WebSocketClientConnection { |
| 104 /** | 104 /** |
| 105 * Creates a new web socket client connection based on a HTTP client | 105 * Creates a new web socket client connection based on a HTTP client |
| 106 * connection. The HTTP client connection must be freshly opened. | 106 * connection. The HTTP client connection must be freshly opened. |
| 107 */ | 107 */ |
| 108 factory WebSocketClientConnection(HttpClientConnection conn, | 108 factory WebSocketClientConnection(HttpClientConnection conn, |
| 109 [List<String> protocols]) { | 109 [List<String> protocols]) { |
| 110 return new _WebSocketClientConnection(conn, protocols); | 110 return new _WebSocketClientConnection(conn, protocols); |
| 111 } | 111 } |
| 112 | 112 |
| 113 /** | 113 /** |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 */ | 294 */ |
| 295 void send(data); | 295 void send(data); |
| 296 } | 296 } |
| 297 | 297 |
| 298 | 298 |
| 299 class WebSocketException implements Exception { | 299 class WebSocketException implements Exception { |
| 300 const WebSocketException([String this.message = ""]); | 300 const WebSocketException([String this.message = ""]); |
| 301 String toString() => "WebSocketException: $message"; | 301 String toString() => "WebSocketException: $message"; |
| 302 final String message; | 302 final String message; |
| 303 } | 303 } |
| OLD | NEW |