OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:async/async.dart'; | 8 import 'package:async/async.dart'; |
9 import 'package:stream_channel/stream_channel.dart'; | 9 import 'package:stream_channel/stream_channel.dart'; |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 stream = stream.handleError((error) => | 78 stream = stream.handleError((error) => |
79 throw new WebSocketChannelException.from(error)); | 79 throw new WebSocketChannelException.from(error)); |
80 } | 80 } |
81 | 81 |
82 /// A [WebSocketSink] that forwards [close] calls to a `dart:io` [WebSocket]. | 82 /// A [WebSocketSink] that forwards [close] calls to a `dart:io` [WebSocket]. |
83 class _IOWebSocketSink extends DelegatingStreamSink implements WebSocketSink { | 83 class _IOWebSocketSink extends DelegatingStreamSink implements WebSocketSink { |
84 /// The underlying socket. | 84 /// The underlying socket. |
85 final WebSocket _webSocket; | 85 final WebSocket _webSocket; |
86 | 86 |
87 _IOWebSocketSink(WebSocket webSocket) | 87 _IOWebSocketSink(WebSocket webSocket) |
88 : super(webSocket), | 88 : _webSocket = webSocket, |
89 _webSocket = webSocket; | 89 super(webSocket); |
90 | 90 |
91 Future close([int closeCode, String closeReason]) => | 91 Future close([int closeCode, String closeReason]) => |
92 _webSocket.close(closeCode, closeReason); | 92 _webSocket.close(closeCode, closeReason); |
93 } | 93 } |
OLD | NEW |