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

Unified Diff: runtime/bin/websocket_impl.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 | « runtime/bin/websocket.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/websocket_impl.dart
diff --git a/runtime/bin/websocket_impl.dart b/runtime/bin/websocket_impl.dart
index 49397aeb3bc74acdd4b9adf4bdaea2a0af8e05a2..dad76d798e45951717e4929f177ac2846d4839ba 100644
--- a/runtime/bin/websocket_impl.dart
+++ b/runtime/bin/websocket_impl.dart
@@ -214,7 +214,8 @@ class _WebSocketProtocolProcessor {
index++;
}
} catch (e) {
- if (onClosed !== null) onClosed(1002, "Protocol error");
+ if (onClosed !== null) onClosed(WebSocketStatus.PROTOCOL_ERROR,
+ "Protocol error");
_state = FAILURE;
}
}
@@ -224,7 +225,8 @@ class _WebSocketProtocolProcessor {
*/
void closed() {
if (_state == START || _state == CLOSED || _state == FAILURE) return;
- if (onClosed !== null) onClosed(1006, "Connection closed unexpectedly");
+ if (onClosed !== null) onClosed(WebSocketStatus.ABNORMAL_CLOSURE,
+ "Connection closed unexpectedly");
_state = CLOSED;
}
@@ -280,7 +282,7 @@ class _WebSocketProtocolProcessor {
void _controlFrameEnd() {
switch (_opcode) {
case _WebSocketOpcode.CLOSE:
- int status = 1005;
+ int status = WebSocketStatus.NO_STATUS_RECEIVED;
String reason = "";
if (_controlPayload.length > 0) {
if (_controlPayload.length == 1) {
@@ -382,7 +384,8 @@ class _WebSocketConnectionBase {
// that as an error.
if (_closeTimer !== null) _closeTimer.cancel();
} else {
- if (_onClosed !== null) _onClosed(1006, "Unexpected close");
+ if (_onClosed !== null) _onClosed(WebSocketStatus.ABNORMAL_CLOSURE,
+ "Unexpected close");
}
_socket.close();
};
@@ -636,7 +639,7 @@ class _WebSocketClientConnection
_conn.onResponse = _onHttpClientResponse;
_conn.onError = (e) {
if (_onClosed !== null) {
- _onClosed(1006, "$e");
+ _onClosed(WebSocketStatus.ABNORMAL_CLOSURE, "$e");
}
};
@@ -795,7 +798,9 @@ class _WebSocket implements WebSocket {
_wsconn.onNoUpgrade = (response) {
if (_onclose !== null) {
_onclose(
- new _WebSocketCloseEvent(true, 1006, "Connection not upgraded"));
+ new _WebSocketCloseEvent(true,
+ WebSocketStatus.ABNORMAL_CLOSURE,
+ "Connection not upgraded"));
}
};
}
« no previous file with comments | « runtime/bin/websocket.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698