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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 StreamSubscription listen(void onData(message), | 819 StreamSubscription listen(void onData(message), |
820 {void onError(error), | 820 {void onError(error), |
821 void onDone(), | 821 void onDone(), |
822 bool cancelOnError}) { | 822 bool cancelOnError}) { |
823 return _controller.stream.listen(onData, | 823 return _controller.stream.listen(onData, |
824 onError: onError, | 824 onError: onError, |
825 onDone: onDone, | 825 onDone: onDone, |
826 cancelOnError: cancelOnError); | 826 cancelOnError: cancelOnError); |
827 } | 827 } |
828 | 828 |
829 Duration get pingnterval => _pingInterval; | 829 Duration get pingInterval => _pingInterval; |
830 | 830 |
831 void set pingInterval(Duration interval) { | 831 void set pingInterval(Duration interval) { |
832 if (_writeClosed) return; | 832 if (_writeClosed) return; |
833 if (_pingTimer != null) _pingTimer.cancel(); | 833 if (_pingTimer != null) _pingTimer.cancel(); |
834 _pingInterval = interval; | 834 _pingInterval = interval; |
835 | 835 |
836 if (_pingInterval == null) return; | 836 if (_pingInterval == null) return; |
837 | 837 |
838 _pingTimer = new Timer(_pingInterval, () { | 838 _pingTimer = new Timer(_pingInterval, () { |
839 if (_writeClosed) return; | 839 if (_writeClosed) return; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 (code < WebSocketStatus.NORMAL_CLOSURE || | 874 (code < WebSocketStatus.NORMAL_CLOSURE || |
875 code == WebSocketStatus.RESERVED_1004 || | 875 code == WebSocketStatus.RESERVED_1004 || |
876 code == WebSocketStatus.NO_STATUS_RECEIVED || | 876 code == WebSocketStatus.NO_STATUS_RECEIVED || |
877 code == WebSocketStatus.ABNORMAL_CLOSURE || | 877 code == WebSocketStatus.ABNORMAL_CLOSURE || |
878 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && | 878 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && |
879 code < WebSocketStatus.RESERVED_1015) || | 879 code < WebSocketStatus.RESERVED_1015) || |
880 (code >= WebSocketStatus.RESERVED_1015 && | 880 (code >= WebSocketStatus.RESERVED_1015 && |
881 code < 3000)); | 881 code < 3000)); |
882 } | 882 } |
883 } | 883 } |
OLD | NEW |