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

Unified Diff: sdk/lib/io/websocket.dart

Issue 12383051: Change the web socket interface (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/io/websocket_impl.dart » ('j') | sdk/lib/io/websocket_impl.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/websocket.dart
diff --git a/sdk/lib/io/websocket.dart b/sdk/lib/io/websocket.dart
index 96b3165f11cf23a1c4ed60db5e985da09ab2b40f..14481b2a0e7ad656fff4b2c635f837b98b49beea 100644
--- a/sdk/lib/io/websocket.dart
+++ b/sdk/lib/io/websocket.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -47,54 +47,11 @@ abstract class WebSocketTransformer
/**
- * Base class for the events generated by the [WebSocket] stream.
+ * A client or server web socket connection. The stream exposes the
+ * messages received. A text message will be of type [:String:] and a
+ * binary message will be of type [:List<int>:].
*/
-abstract class Event { }
-
-/**
- * Event delivered when there is data on a web socket connection.
- */
-abstract class MessageEvent extends Event {
- /**
- * The type of [message] is either [:String:] or [:List<int>:]
- * depending on whether it is a text or binary message. If the
- * message is empty [message] will be [:null:]
- * If the message is a [:List<int>:] then it will contain byte values
- * from 0 to 255.
- */
- get data;
-}
-
-
-/**
- * Event delivered when a web socket connection is closed.
- */
-abstract class CloseEvent extends Event {
- /**
- * Returns whether the connection was closed cleanly or not.
- */
- bool get wasClean;
-
- /**
- * Returns the web socket connection close code provided by the
- * server.
- */
- int get code;
-
- /**
- * Returns the web socket connection close reason provided by the
- * server.
- */
- String get reason;
-}
-
-
-/**
- * A client or server web socket connection. This interface is compliant
- * with the W3C browser API for web sockets specified in
- * http://dev.w3.org/html5/websockets/.
- */
-abstract class WebSocket implements Stream<Event> {
+abstract class WebSocket implements Stream {
/**
* Possible states of the connection.
*/
@@ -118,11 +75,6 @@ abstract class WebSocket implements Stream<Event> {
int get readyState;
/**
- * Returns the number of bytes currently buffered for transmission.
- */
- int get bufferedAmount;
-
- /**
* The extensions property is initially the empty string. After the
* web socket connection is established this string reflects the
* extensions used by the server.
@@ -138,6 +90,18 @@ abstract class WebSocket implements Stream<Event> {
String get protocol;
/**
+ * The close code set when the web socket connection is closed. If
+ * there is no close code available this property will be [:null:]
+ */
+ int get closeCode;
+
+ /**
+ * The close reason set when the web socket connection is closed. If
+ * there is no close reason available this property will be [:null:]
+ */
+ String get closeReason;
+
+ /**
* Closes the web socket connection.
*/
void close([int code, String reason]);
« no previous file with comments | « no previous file | sdk/lib/io/websocket_impl.dart » ('j') | sdk/lib/io/websocket_impl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698