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

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

Issue 10383039: Implemented W3C complient web socket client interface (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 send(message); 134 send(message);
135 135
136 /** 136 /**
137 * Close the web socket connection. The default value for [status] 137 * Close the web socket connection. The default value for [status]
138 * and [reason] are [:null:]. 138 * and [reason] are [:null:].
139 */ 139 */
140 close([int status, String reason]); 140 close([int status, String reason]);
141 } 141 }
142 142
143 143
144 interface WebSocketDataEvent default _WebSocketDataEvent {
145 get data();
146 }
147
148
149 interface WebSocketCloseEvent default _WebSocketCloseEvent {
150 bool get wasClean();
151 int get code();
152 String get reason();
153 }
154
155
156 interface WebSocket default _WebSocket {
157 static final int CONNECTING = 0;
158 static final int OPEN = 1;
159 static final int CLOSING = 2;
160 static final int CLOSED = 3;
161
162 WebSocket(String url, [protocols]);
Mads Ager (google) 2012/05/07 11:46:57 What is protocols? Is there a type that it makes s
Søren Gjesse 2012/05/07 12:55:24 Sorry abut that. I totally forgot the comments on
163
164 int get readyState();
165 int get bufferedAmount();
166
167 void set onopen(Function callback);
168 void set onerror(Function callback);
169 void set onclose(Function callback);
170 String get extensions();
171 String get protocol();
172 void close(int code, String reason);
173
174 void set onmessage(Function callback(event));
175 void send(data);
176 }
177
178
144 class WebSocketException implements Exception { 179 class WebSocketException implements Exception {
145 const WebSocketException([String this.message = ""]); 180 const WebSocketException([String this.message = ""]);
146 String toString() => "WebSocketException: $message"; 181 String toString() => "WebSocketException: $message";
147 final String message; 182 final String message;
148 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698