Skip to content

Does this library handle serialization? #1429

Answered by niklasad1
Redhawk18 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey again,

I thought you wanted to write a server implementation but you are using the client alright.

Also is there a way I can generate fields like the jsonrpc field that is always "2.0"?

jsonrpsee takes care of that for you and you don't have to define request and response types with jsonrpc specific stuff.

So another example how to use a typed client for your use-case and to call mining.subscribe you can do it as follows:

#[rpc(client)]
pub trait Rpc {
	#[method(name = "mining.subscribe")]
	async fn subscribe(
		&self,
		version: String,
		session_id: String,
		host: String,
		port: usize,
	) -> Result<(String, String), ErrorObjectOwned>;
}

#[tokio::main]
async fn main() -> anyhow::R…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@Redhawk18
Comment options

Comment options

You must be logged in to vote
5 replies
@Redhawk18
Comment options

@niklasad1
Comment options

@Redhawk18
Comment options

@niklasad1
Comment options

@Redhawk18
Comment options

Answer selected by Redhawk18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants