Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: pkg/json_rpc_2/lib/src/server.dart

Issue 691053006: Add a Client class to json_rpc_2. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/json_rpc_2/lib/src/exception.dart ('k') | pkg/json_rpc_2/lib/src/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 json_rpc_2.server; 5 library json_rpc_2.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 10
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 /// 62 ///
63 /// If [requests] is a [StreamSink] as well as a [Stream], [responses] may be 63 /// If [requests] is a [StreamSink] as well as a [Stream], [responses] may be
64 /// omitted. 64 /// omitted.
65 /// 65 ///
66 /// Note that the server won't begin listening to [requests] until 66 /// Note that the server won't begin listening to [requests] until
67 /// [Server.listen] is called. 67 /// [Server.listen] is called.
68 Server.withoutJson(Stream requests, [StreamSink responses]) 68 Server.withoutJson(Stream requests, [StreamSink responses])
69 : _streams = new TwoWayStream.withoutJson( 69 : _streams = new TwoWayStream.withoutJson(
70 "Server", requests, "requests", responses, "responses"); 70 "Server", requests, "requests", responses, "responses");
71 71
72 /// Users of the library should not use this constructor.
73 Server.internal(this._streams);
74
72 /// Starts listening to the underlying stream. 75 /// Starts listening to the underlying stream.
73 /// 76 ///
74 /// Returns a [Future] that will complete when the stream is closed or when it 77 /// Returns a [Future] that will complete when the stream is closed or when it
75 /// has an error. 78 /// has an error.
76 /// 79 ///
77 /// [listen] may only be called once. 80 /// [listen] may only be called once.
78 Future listen() => _streams.listen(_handleRequest); 81 Future listen() => _streams.listen(_handleRequest);
79 82
80 /// Closes the server's request subscription and response sink. 83 /// Closes the server's request subscription and response sink.
81 /// 84 ///
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return syncFuture(() => iterator.current(params)).catchError((error) { 240 return syncFuture(() => iterator.current(params)).catchError((error) {
238 if (error is! RpcException) throw error; 241 if (error is! RpcException) throw error;
239 if (error.code != error_code.METHOD_NOT_FOUND) throw error; 242 if (error.code != error_code.METHOD_NOT_FOUND) throw error;
240 return _tryNext(); 243 return _tryNext();
241 }); 244 });
242 } 245 }
243 246
244 return _tryNext(); 247 return _tryNext();
245 } 248 }
246 } 249 }
OLDNEW
« no previous file with comments | « pkg/json_rpc_2/lib/src/exception.dart ('k') | pkg/json_rpc_2/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698