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

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

Issue 10872033: Change getters syntax in dart:io library. (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 | « runtime/bin/string_stream.dart ('k') | runtime/bin/websocket_impl.dart » ('j') | no next file with comments »
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 /** 163 /**
164 * Event delivered when there is data on a web socket connection. 164 * Event delivered when there is data on a web socket connection.
165 */ 165 */
166 interface MessageEvent extends Event default _WebSocketMessageEvent { 166 interface MessageEvent extends Event default _WebSocketMessageEvent {
167 /** 167 /**
168 * The type of [message] is either [:String:] or [:List<int>:] 168 * The type of [message] is either [:String:] or [:List<int>:]
169 * depending on whether it is a text or binary message. If the 169 * depending on whether it is a text or binary message. If the
170 * message is empty [message] will be [:null:] 170 * message is empty [message] will be [:null:]
171 */ 171 */
172 get data(); 172 get data;
173 } 173 }
174 174
175 175
176 /** 176 /**
177 * Event delivered when a web socket connection is closed. 177 * Event delivered when a web socket connection is closed.
178 */ 178 */
179 interface CloseEvent extends Event default _WebSocketCloseEvent { 179 interface CloseEvent extends Event default _WebSocketCloseEvent {
180 /** 180 /**
181 * Returns whether the connection was closed cleanly or not. 181 * Returns whether the connection was closed cleanly or not.
182 */ 182 */
183 bool get wasClean(); 183 bool get wasClean;
184 184
185 /** 185 /**
186 * Returns the web socket connection close code provided by the 186 * Returns the web socket connection close code provided by the
187 * server. 187 * server.
188 */ 188 */
189 int get code(); 189 int get code;
190 190
191 /** 191 /**
192 * Returns the web socket connection close reason provided by the 192 * Returns the web socket connection close reason provided by the
193 * server. 193 * server.
194 */ 194 */
195 String get reason(); 195 String get reason;
196 } 196 }
197 197
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 final int CONNECTING = 0;
209 static final int OPEN = 1; 209 static final int OPEN = 1;
210 static final int CLOSING = 2; 210 static final int CLOSING = 2;
211 static final int CLOSED = 3; 211 static final 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 /**
222 * Returns the current state of the connection. 222 * Returns the current state of the connection.
223 */ 223 */
224 int get readyState(); 224 int get readyState;
225 225
226 /** 226 /**
227 * Returns the number of bytes currently buffered for transmission. 227 * Returns the number of bytes currently buffered for transmission.
228 */ 228 */
229 int get bufferedAmount(); 229 int get bufferedAmount;
230 230
231 /** 231 /**
232 * Sets the callback to be called when a web socket connection has 232 * Sets the callback to be called when a web socket connection has
233 * been established. 233 * been established.
234 */ 234 */
235 void set onopen(void callback()); 235 void set onopen(void callback());
236 236
237 /** 237 /**
238 * Sets the callback to be called when the web socket connection 238 * Sets the callback to be called when the web socket connection
239 * encountered an error. 239 * encountered an error.
240 */ 240 */
241 void set onerror(void callback(e)); 241 void set onerror(void callback(e));
242 242
243 /** 243 /**
244 * Sets the callback to be called when the web socket connection is 244 * Sets the callback to be called when the web socket connection is
245 * closed. 245 * closed.
246 */ 246 */
247 void set onclose(void callback(CloseEvent event)); 247 void set onclose(void callback(CloseEvent event));
248 248
249 /** 249 /**
250 * The extensions property is initially the empty string. After the 250 * The extensions property is initially the empty string. After the
251 * web socket connection is established this string reflects the 251 * web socket connection is established this string reflects the
252 * extensions used by the server. 252 * extensions used by the server.
253 */ 253 */
254 String get extensions(); 254 String get extensions;
255 255
256 /** 256 /**
257 * The protocol property is initially the empty string. After the 257 * The protocol property is initially the empty string. After the
258 * web socket connection is established the value is the subprotocol 258 * web socket connection is established the value is the subprotocol
259 * selected by the server. If no subprotocol is negotiated the 259 * selected by the server. If no subprotocol is negotiated the
260 * value will remain [:null:]. 260 * value will remain [:null:].
261 */ 261 */
262 String get protocol(); 262 String get protocol;
263 263
264 /** 264 /**
265 * Closes the web socket connection. 265 * Closes the web socket connection.
266 */ 266 */
267 void close(int code, String reason); 267 void close(int code, String reason);
268 268
269 /** 269 /**
270 * Sets the callback to be called when a message have been 270 * Sets the callback to be called when a message have been
271 * received. 271 * received.
272 */ 272 */
273 void set onmessage(void callback(MessageEvent event)); 273 void set onmessage(void callback(MessageEvent event));
274 274
275 /** 275 /**
276 * Sends data on the web socket connection. The data in [data] must 276 * Sends data on the web socket connection. The data in [data] must
277 * be either a [:String:] or [:List<int>:] holding bytes. 277 * be either a [:String:] or [:List<int>:] holding bytes.
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 }
OLDNEW
« no previous file with comments | « runtime/bin/string_stream.dart ('k') | runtime/bin/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698