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

Side by Side Diff: sdk/lib/io/websocket_impl.dart

Issue 1273663002: Echo the WebSocket close reason as well as the close code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/standalone/io/web_socket_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; 7 const String _webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
8 8
9 // Matches _WebSocketOpcode. 9 // Matches _WebSocketOpcode.
10 class _WebSocketMessageType { 10 class _WebSocketMessageType {
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 // An error happened, set the close code set above. 881 // An error happened, set the close code set above.
882 _closeCode = _outCloseCode; 882 _closeCode = _outCloseCode;
883 _closeReason = _outCloseReason; 883 _closeReason = _outCloseReason;
884 _controller.close(); 884 _controller.close();
885 }, 885 },
886 onDone: () { 886 onDone: () {
887 if (_closeTimer != null) _closeTimer.cancel(); 887 if (_closeTimer != null) _closeTimer.cancel();
888 if (_readyState == WebSocket.OPEN) { 888 if (_readyState == WebSocket.OPEN) {
889 _readyState = WebSocket.CLOSING; 889 _readyState = WebSocket.CLOSING;
890 if (!_isReservedStatusCode(transformer.closeCode)) { 890 if (!_isReservedStatusCode(transformer.closeCode)) {
891 _close(transformer.closeCode); 891 _close(transformer.closeCode, transformer.closeReason);
892 } else { 892 } else {
893 _close(); 893 _close();
894 } 894 }
895 _readyState = WebSocket.CLOSED; 895 _readyState = WebSocket.CLOSED;
896 } 896 }
897 // Protocol close, use close code from transformer. 897 // Protocol close, use close code from transformer.
898 _closeCode = transformer.closeCode; 898 _closeCode = transformer.closeCode;
899 _closeReason = transformer.closeReason; 899 _closeReason = transformer.closeReason;
900 _controller.close(); 900 _controller.close();
901 }, 901 },
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 (code < WebSocketStatus.NORMAL_CLOSURE || 1030 (code < WebSocketStatus.NORMAL_CLOSURE ||
1031 code == WebSocketStatus.RESERVED_1004 || 1031 code == WebSocketStatus.RESERVED_1004 ||
1032 code == WebSocketStatus.NO_STATUS_RECEIVED || 1032 code == WebSocketStatus.NO_STATUS_RECEIVED ||
1033 code == WebSocketStatus.ABNORMAL_CLOSURE || 1033 code == WebSocketStatus.ABNORMAL_CLOSURE ||
1034 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && 1034 (code > WebSocketStatus.INTERNAL_SERVER_ERROR &&
1035 code < WebSocketStatus.RESERVED_1015) || 1035 code < WebSocketStatus.RESERVED_1015) ||
1036 (code >= WebSocketStatus.RESERVED_1015 && 1036 (code >= WebSocketStatus.RESERVED_1015 &&
1037 code < 3000)); 1037 code < 3000));
1038 } 1038 }
1039 } 1039 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/web_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698