| 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 _closeCode = WebSocketStatus.ABNORMAL_CLOSURE; | 557 _closeCode = WebSocketStatus.ABNORMAL_CLOSURE; |
| 558 _controller.addError(error); | 558 _controller.addError(error); |
| 559 _controller.close(); | 559 _controller.close(); |
| 560 }) | 560 }) |
| 561 .whenComplete(() { | 561 .whenComplete(() { |
| 562 _writeClosed = true; | 562 _writeClosed = true; |
| 563 }); | 563 }); |
| 564 } | 564 } |
| 565 | 565 |
| 566 StreamSubscription listen(void onData(message), | 566 StreamSubscription listen(void onData(message), |
| 567 {void onError(AsyncError error), | 567 {void onError(error), |
| 568 void onDone(), | 568 void onDone(), |
| 569 bool unsubscribeOnError}) { | 569 bool unsubscribeOnError}) { |
| 570 return _controller.stream.listen(onData, | 570 return _controller.stream.listen(onData, |
| 571 onError: onError, | 571 onError: onError, |
| 572 onDone: onDone, | 572 onDone: onDone, |
| 573 unsubscribeOnError: unsubscribeOnError); | 573 unsubscribeOnError: unsubscribeOnError); |
| 574 } | 574 } |
| 575 | 575 |
| 576 int get readyState => _readyState; | 576 int get readyState => _readyState; |
| 577 | 577 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 if (data != null) { | 687 if (data != null) { |
| 688 _socket.add(data); | 688 _socket.add(data); |
| 689 } | 689 } |
| 690 } catch (_) { | 690 } catch (_) { |
| 691 // The socket can be closed before _socket.done have a chance | 691 // The socket can be closed before _socket.done have a chance |
| 692 // to complete. | 692 // to complete. |
| 693 _writeClosed = true; | 693 _writeClosed = true; |
| 694 } | 694 } |
| 695 } | 695 } |
| 696 } | 696 } |
| OLD | NEW |