| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library channel; | 5 library channel; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 | 10 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 .transform(new ResponseConverter()) | 195 .transform(new ResponseConverter()) |
| 196 .asBroadcastStream(); | 196 .asBroadcastStream(); |
| 197 notificationStream = jsonStream | 197 notificationStream = jsonStream |
| 198 .where((json) => json[Notification.EVENT] != null) | 198 .where((json) => json[Notification.EVENT] != null) |
| 199 .transform(new NotificationConverter()) | 199 .transform(new NotificationConverter()) |
| 200 .asBroadcastStream(); | 200 .asBroadcastStream(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 @override | 203 @override |
| 204 Future close() { | 204 Future close() { |
| 205 // TODO: implement close | 205 return output.close(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 @override | 208 @override |
| 209 Future<Response> sendRequest(Request request) { | 209 Future<Response> sendRequest(Request request) { |
| 210 String id = request.id; | 210 String id = request.id; |
| 211 output.writeln(JSON.encode(request.toJson())); | 211 output.writeln(JSON.encode(request.toJson())); |
| 212 return responseStream.firstWhere((Response response) => response.id == id); | 212 return responseStream.firstWhere((Response response) => response.id == id); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 | 349 |
| 350 @override | 350 @override |
| 351 void close() { | 351 void close() { |
| 352 closed = true; | 352 closed = true; |
| 353 sink.close(); | 353 sink.close(); |
| 354 } | 354 } |
| 355 } | 355 } |
| OLD | NEW |