JSON-RPC Node server with WS support

Hi, everyone. I'm new to Rust and to this community as a whole. It's only been a day or so since I've started using Rust. My job requires me to make a JSON-RPC node server which will communicate using websockets. I've been looking into crates/packages like jsonrpsee but I haven't had much luck finding code examples or any real usage examples. Is there a proper workflow that I should be aware of before I start doing this task? I'm reading the docs but haven't gotten much further with them. Is it all dependent upon a hit and trial in the end to see what works?

P.S. I might've missed a lot of things while looking through docs. Please tell me where I can get resources for these packages (jsonrpsee, tokio, anywho, tracing) if there are any aside from the package listing

Examples are usually found in an examples/ directory in a project's git repo. Otherwise I don't think there is much documentation on jsonrpsee, the API docs look sparse to me and I couldn't find any links to additional documentation resources. Tokio, tracing and anyhow on the other hand are well documented, if you are familiar with Rust and the asynchronous programming model to some extend:

That being said, not knowing Rust and starting the learning journey with an RPC server is a really tough ask, in my opinion. Rust offers you a lot more control than higher-level languages with their abundance of well-established and newcomer-friendly frameworks, like Node.js, Python, Java or C#. It easy to get overwhelmed at first and you might get frustrated, especially if you dive in the deep end, which many say is async Rust.

Thank you for the resources. No wonder I thought it was weird that jsonrpsee didn't have any resources. I'll try using it however I can. Also, I'm a little familiar with Rust. I'm not experienced by any means but it's a good opportunity to learn regardless. I'm currently going through the docs and practicing along with it. I'll try my best and see if I can figure something out.

1 Like

I wrote a node server and a JSON exchange stream by myself. I wouldn't recommend my solution to you, just stay on the stack you selected to because it's based on high quality reliable component. But if you or someone else is looking for a quick solution she or he can implement, then check SimCommander. The reference has references on all used components.