| 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 // Matches _WebSocketOpcode. | 9 // Matches _WebSocketOpcode. |
| 10 class _WebSocketMessageType { | 10 class _WebSocketMessageType { |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 _controller.close(); | 890 _controller.close(); |
| 891 }, | 891 }, |
| 892 cancelOnError: true); | 892 cancelOnError: true); |
| 893 _subscription.pause(); | 893 _subscription.pause(); |
| 894 _controller = new StreamController(sync: true, | 894 _controller = new StreamController(sync: true, |
| 895 onListen: _subscription.resume, | 895 onListen: _subscription.resume, |
| 896 onPause: _subscription.pause, | 896 onPause: _subscription.pause, |
| 897 onResume: _subscription.resume); | 897 onResume: _subscription.resume); |
| 898 | 898 |
| 899 _webSockets[_serviceId] = this; | 899 _webSockets[_serviceId] = this; |
| 900 try { _socket._owner = this; } catch (_) {} |
| 900 } | 901 } |
| 901 | 902 |
| 902 StreamSubscription listen(void onData(message), | 903 StreamSubscription listen(void onData(message), |
| 903 {Function onError, | 904 {Function onError, |
| 904 void onDone(), | 905 void onDone(), |
| 905 bool cancelOnError}) { | 906 bool cancelOnError}) { |
| 906 return _controller.stream.listen(onData, | 907 return _controller.stream.listen(onData, |
| 907 onError: onError, | 908 onError: onError, |
| 908 onDone: onDone, | 909 onDone: onDone, |
| 909 cancelOnError: cancelOnError); | 910 cancelOnError: cancelOnError); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 (code < WebSocketStatus.NORMAL_CLOSURE || | 1006 (code < WebSocketStatus.NORMAL_CLOSURE || |
| 1006 code == WebSocketStatus.RESERVED_1004 || | 1007 code == WebSocketStatus.RESERVED_1004 || |
| 1007 code == WebSocketStatus.NO_STATUS_RECEIVED || | 1008 code == WebSocketStatus.NO_STATUS_RECEIVED || |
| 1008 code == WebSocketStatus.ABNORMAL_CLOSURE || | 1009 code == WebSocketStatus.ABNORMAL_CLOSURE || |
| 1009 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && | 1010 (code > WebSocketStatus.INTERNAL_SERVER_ERROR && |
| 1010 code < WebSocketStatus.RESERVED_1015) || | 1011 code < WebSocketStatus.RESERVED_1015) || |
| 1011 (code >= WebSocketStatus.RESERVED_1015 && | 1012 (code >= WebSocketStatus.RESERVED_1015 && |
| 1012 code < 3000)); | 1013 code < 3000)); |
| 1013 } | 1014 } |
| 1014 } | 1015 } |
| OLD | NEW |