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

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

Issue 14208007: Improve WebSocket interface by making it implement StreamSink. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « sdk/lib/io/io_sink.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »
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 65249f13ad9a449ad9067f34cf34f9a515b34cde..5cbe278eb8dab2b9bc3a4c75e3724ee435ffde90 100644
--- a/sdk/lib/io/websocket.dart
+++ b/sdk/lib/io/websocket.dart
@@ -80,7 +80,7 @@ abstract class WebSocketTransformer
* messages received. A text message will be of type [:String:] and a
* binary message will be of type [:List<int>:].
*/
-abstract class WebSocket implements Stream {
+abstract class WebSocket implements Stream, StreamSink {
/**
* Possible states of the connection.
*/
@@ -131,15 +131,25 @@ abstract class WebSocket implements Stream {
String get closeReason;
/**
- * Closes the web socket connection.
+ * Closes the web socket connection. Set the optional [code] and [reason]
+ * arguments to send close information to the remote peer. If they are
+ * omitted, the peer will see [WebSocketStatus.NO_STATUS_RECEIVED] code
+ * with no reason.
*/
- void close([int code, String reason]);
+ Future close([int code, String reason]);
/**
* Sends data on the web socket connection. The data in [data] must
* be either a [:String:], or a [:List<int>:] holding bytes.
*/
- void send(data);
+ void add(data);
+
+ /**
+ * Sends data from a stream on web socket connection. Each data event from
+ * [stream] will be send as a single WebSocket frame. The data from [stream]
+ * must be either [:String:]s, or [:List<int>:]s holding bytes.
+ */
+ Future addStream(Stream stream);
}
« no previous file with comments | « sdk/lib/io/io_sink.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698