Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonrpc-core should support io::Read and io::Write #82

Closed
tomusdrw opened this issue Mar 20, 2017 · 6 comments
Closed

jsonrpc-core should support io::Read and io::Write #82

tomusdrw opened this issue Mar 20, 2017 · 6 comments
Labels

Comments

@tomusdrw
Copy link
Contributor

Instead of allocating a String and then passing it to jsonrpc-core it should be possible to just pass instance of io::Read and io::Write (later). See:

https://docs.rs/serde_json/0.9.5/serde_json/fn.from_reader.html
https://docs.rs/serde_json/0.9.5/serde_json/fn.to_writer.html

@debris
Copy link
Contributor

debris commented Mar 20, 2017

yes, but I'm afraid it won't work for network requests, cause io::Read, io::Write may return WouldBlock error

What we need is serde using futures internally

@tomusdrw
Copy link
Contributor Author

I think it would be possible to create a buffered reader that addresses this issue. You just need to make sure that BufferedReader polling occurs in the event loop, and serde_json::from_reader is blocking some other thread.
Although it indeed seems a bit complicated.

@tomusdrw tomusdrw added the feat label Mar 20, 2017
@mmacedoeu
Copy link

@NikVolf
Copy link
Contributor

NikVolf commented May 3, 2017

@mmacedoeu yep but serde does not use it
and if it were, it would have to return futures instead of instant result on such (de)serialization requests

@mmacedoeu
Copy link

mmacedoeu commented May 3, 2017

@tomusdrw
Copy link
Contributor Author

Closing since it seems unrealistic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants