You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
jsonrpc's ServerBuilder accepts a custom executor or starts its own and then requires the user to start it.
On the other hand, both hyper and tarpc build a Server struct that is a plain Future that can be spawned on user's executor of choice. It is way more ergonomic and in line with async ecosystem's move towards separation of logic and its execution.
The text was updated successfully, but these errors were encountered:
@vorot93 I agree 100%. Old API is more of a legacy from the times where tokio/futures and async in general was not really a thing yet, we should think on rewriting this if all transports support async.
With a cursory look through the current code, IMHO since ServerHandler is a valid hyper Service, to support this without a breaking API change it would be a good idea to either:
Allow taking the ServerHandler from an existing Server, or
Split the creation of ServerHandler from Server::serve_http() and provide a way to create Server instances from existing ServerHandlers
The latter option would be a much better fit because users who require just the handler (because they have an existing tokio runtime or hyper instance) can utilize their existing code without extra overhead, while giving a simpler ready-made instance for easier setup
christobias
added a commit
to christobias/jsonrpc
that referenced
this issue
Aug 2, 2019
jsonrpc's ServerBuilder accepts a custom executor or starts its own and then requires the user to
start
it.On the other hand, both hyper and tarpc build a Server struct that is a plain
Future
that can be spawned on user's executor of choice. It is way more ergonomic and in line with async ecosystem's move towards separation of logic and its execution.The text was updated successfully, but these errors were encountered: