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

Unified Diff: runtime/bin/websocket.dart

Issue 10907211: Add web socket error codes constants (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/websocket_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/websocket.dart
diff --git a/runtime/bin/websocket.dart b/runtime/bin/websocket.dart
index e7375da3baf7c8c140738047b652a83ef31f5f60..ef8876cafd4bdd3928642687a540514ebf409578 100644
--- a/runtime/bin/websocket.dart
+++ b/runtime/bin/websocket.dart
@@ -3,6 +3,25 @@
// BSD-style license that can be found in the LICENSE file.
/**
+ * Web socket status codes used when closing a web socket connection.
+ */
+interface WebSocketStatus {
+ static const int NORMAL_CLOSURE = 1000;
+ static const int GOING_AWAY = 1001;
+ static const int PROTOCOL_ERROR = 1002;
+ static const int UNSUPPORTED_DATA = 1003;
+ static const int RESERVED_1004 = 1004;
+ static const int NO_STATUS_RECEIVED = 1005;
+ static const int ABNORMAL_CLOSURE = 1006;
+ static const int INVALID_FRAME_PAYLOAD_DATA = 1007;
+ static const int POLICY_VIOLATION = 1008;
+ static const int MESSAGE_TOO_BIG = 1009;
+ static const int MISSING_MANDATORY_EXTENSION = 1010;
+ static const int INTERNAL_SERVER_ERROR = 1011;
+ static const int RESERVED_1015 = 1015;
+}
+
+/**
* The web socket protocol is implemented by a HTTP server handler
* which can be instantiated like this:
*
@@ -49,7 +68,9 @@ interface WebSocketConnection extends Hashable {
/**
* Sets the callback to be called when the web socket connection is
- * closed.
+ * closed. [status] indicate the reason for closing. For network
+ * errors the value of [status] will be
+ * WebSocketStatus.ABNORMAL_CLOSURE].
*/
void set onClosed(void callback(int status, String reason));
@@ -108,7 +129,9 @@ interface WebSocketClientConnection
/**
* Sets the callback to be called when the web socket connection is
- * closed.
+ * closed. [status] indicate the reason for closing. For network
+ * errors the value of [status] will be
+ * WebSocketStatus.ABNORMAL_CLOSURE].
*/
void set onClosed(void callback(int status, String reason));
« no previous file with comments | « no previous file | runtime/bin/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698