Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: runtime/bin/websocket.dart

Issue 10907047: Use onClosed instead of onError in the WebSocket classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/websocket_impl.dart » ('j') | runtime/bin/websocket_impl.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 */ 47 */
48 void set onMessage(void callback(message)); 48 void set onMessage(void callback(message));
49 49
50 /** 50 /**
51 * Sets the callback to be called when the web socket connection is 51 * Sets the callback to be called when the web socket connection is
52 * closed. 52 * closed.
53 */ 53 */
54 void set onClosed(void callback(int status, String reason)); 54 void set onClosed(void callback(int status, String reason));
55 55
56 /** 56 /**
57 * Sets the callback to be called when the web socket connection
58 * encountered an error.
59 */
60 void set onError(void callback(e));
61
62 /**
63 * Sends a message. The [message] must be a [:String:] a 57 * Sends a message. The [message] must be a [:String:] a
64 * [:List<int>:] or [:null:]. 58 * [:List<int>:] or [:null:].
65 */ 59 */
66 send(Object message); 60 send(Object message);
67 61
68 /** 62 /**
69 * Close the web socket connection. The default value for [status] 63 * Close the web socket connection. The default value for [status]
70 * and [reason] are [:null:]. 64 * and [reason] are [:null:].
71 */ 65 */
72 close([int status, String reason]); 66 close([int status, String reason]);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 * Sets the callback to be called when the response object for the 116 * Sets the callback to be called when the response object for the
123 * opening handshake did not cause a web socket connection 117 * opening handshake did not cause a web socket connection
124 * upgrade. This will be called in case the response status code is 118 * upgrade. This will be called in case the response status code is
125 * not 101 (Switching Protocols). If this callback is not set the 119 * not 101 (Switching Protocols). If this callback is not set the
126 * [:onError:] callback will be called if the server did not upgrade 120 * [:onError:] callback will be called if the server did not upgrade
127 * the connection. 121 * the connection.
128 */ 122 */
129 void set onNoUpgrade(void callback(HttpClientResponse response)); 123 void set onNoUpgrade(void callback(HttpClientResponse response));
130 124
131 /** 125 /**
132 * Sets the callback to be called when the web socket connection
133 * encountered an error.
134 */
135 void set onError(void callback(e));
136
137 /**
138 * Sends a message. The [message] must be a [:String:] or a 126 * Sends a message. The [message] must be a [:String:] or a
139 * [:List<int>:]. To send an empty message use either an empty 127 * [:List<int>:]. To send an empty message use either an empty
140 * [:String:] or an empty [:List<int>:]. [:null:] cannot be used. 128 * [:String:] or an empty [:List<int>:]. [:null:] cannot be used.
141 */ 129 */
142 send(message); 130 send(message);
143 131
144 /** 132 /**
145 * Close the web socket connection. The default value for [status] 133 * Close the web socket connection. The default value for [status]
146 * and [reason] are [:null:]. 134 * and [reason] are [:null:].
147 */ 135 */
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 */ 266 */
279 void send(data); 267 void send(data);
280 } 268 }
281 269
282 270
283 class WebSocketException implements Exception { 271 class WebSocketException implements Exception {
284 const WebSocketException([String this.message = ""]); 272 const WebSocketException([String this.message = ""]);
285 String toString() => "WebSocketException: $message"; 273 String toString() => "WebSocketException: $message";
286 final String message; 274 final String message;
287 } 275 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/websocket_impl.dart » ('j') | runtime/bin/websocket_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698