OLD | NEW |
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 class _WebSocketMessageType { | 9 class _WebSocketMessageType { |
10 static const int NONE = 0; | 10 static const int NONE = 0; |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 } | 891 } |
892 | 892 |
893 int get readyState => _readyState; | 893 int get readyState => _readyState; |
894 | 894 |
895 String get extensions => null; | 895 String get extensions => null; |
896 String get protocol => null; | 896 String get protocol => null; |
897 int get closeCode => _closeCode; | 897 int get closeCode => _closeCode; |
898 String get closeReason => _closeReason; | 898 String get closeReason => _closeReason; |
899 | 899 |
900 void add(data) => _sink.add(data); | 900 void add(data) => _sink.add(data); |
901 void addError(error) => _sink.addError(error); | 901 void addError(error, [StackTrace stackTrace]) => |
| 902 _sink.addError(error, stackTrace); |
902 Future addStream(Stream stream) => _sink.addStream(stream); | 903 Future addStream(Stream stream) => _sink.addStream(stream); |
903 Future get done => _sink.done; | 904 Future get done => _sink.done; |
904 | 905 |
905 Future close([int code, String reason]) { | 906 Future close([int code, String reason]) { |
906 if (_isReservedStatusCode(code)) { | 907 if (_isReservedStatusCode(code)) { |
907 throw new WebSocketException("Reserved status code $code"); | 908 throw new WebSocketException("Reserved status code $code"); |
908 } | 909 } |
909 if (_outCloseCode == null) { | 910 if (_outCloseCode == null) { |
910 _outCloseCode = code; | 911 _outCloseCode = code; |
911 _outCloseReason = reason; | 912 _outCloseReason = reason; |
(...skipping 16 matching lines...) Expand all Loading... |
928 (code < WebSocketStatus.NORMAL_CLOSURE || | 929 (code < WebSocketStatus.NORMAL_CLOSURE || |
929 code == WebSocketStatus.RESERVED_1004 || | 930 code == WebSocketStatus.RESERVED_1004 || |
930 code == WebSocketStatus.NO_STATUS_RECEIVED || | 931 code == WebSocketStatus.NO_STATUS_RECEIVED || |
931 code == WebSocketStatus.ABNORMAL_CLOSURE || | 932 code == WebSocketStatus.ABNORMAL_CLOSURE || |
932 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && | 933 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && |
933 code < WebSocketStatus.RESERVED_1015) || | 934 code < WebSocketStatus.RESERVED_1015) || |
934 (code >= WebSocketStatus.RESERVED_1015 && | 935 (code >= WebSocketStatus.RESERVED_1015 && |
935 code < 3000)); | 936 code < 3000)); |
936 } | 937 } |
937 } | 938 } |
OLD | NEW |