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

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

Issue 2260073002: RFC: Sending pre-encoded text over a web socket. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 years, 4 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 | « runtime/bin/vmservice/server.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 df6c8cf523390d47e14b0986b4cd27ff3815a016..53f1c7b1ca5556d4e75d2a39b5181392c49deec6 100644
--- a/sdk/lib/io/websocket.dart
+++ b/sdk/lib/io/websocket.dart
@@ -23,6 +23,16 @@ abstract class WebSocketStatus {
static const int RESERVED_1015 = 1015;
}
+
+/**
+ * WebSocket message types used for [WebSocket.sendMessage].
+ */
+enum WebSocketMessageType {
+ TEXT,
+ BINARY
+}
+
+
/**
* The [CompressionOptions] class allows you to control
* the options of WebSocket compression.
@@ -402,6 +412,11 @@ abstract class WebSocket
* must be either `String`s, or `List<int>`s holding bytes.
*/
Future addStream(Stream stream);
+
+ /**
+ * Sends a binary message or a pre-encoded text message.
+ */
+ void sendMessage(WebSocketMessageType type, List<int> bytes);
Lasse Reichstein Nielsen 2016/08/24 05:10:12 For consistency, the name should start with "add".
Lasse Reichstein Nielsen 2016/08/24 05:51:04 Or maybe addUtf8Text - it seems that WebSockets ta
Cutch 2016/08/24 14:01:41 According to the spec https://tools.ietf.org/html/
Lasse Reichstein Nielsen 2016/08/24 14:16:47 That's a perfectly reasonable response, and it sho
}
class WebSocketException implements IOException {
« no previous file with comments | « runtime/bin/vmservice/server.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698