-
Notifications
You must be signed in to change notification settings - Fork 177
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
Make clients clonable #560
Comments
We have been reasoned about it as follows: #243 (comment), to make it explicit for users
You could use
|
Totally makes sense for websocket client, but it's different in nature from http, there's nothing wrong with cloning http client since we can think of it as being stateless. Also
I mean suppose you have a struct struct MyClientWrapper<C: MyRpcClient + Clone> {
client: C,
} You can't pass I see your point, feel free to close the issue, but I would consider the opportunity of deviation from "unified interface" path for the above reasons. |
FWIW we have deviated from the "unified interface" dogma at several junctions in the past. It inevitably leads to some head scratching at times when interfaces are different between the transports, but otoh there are things that simply make sense for one transport and not at all for another. We will discuss this. |
Yupp, I agree that Furthermore, the implementation/behavior is already different between the two thus I see no problem by having |
Closed via #583 |
It's a widespread pattern to implement
Clone
for clients, jsonrpc, reqwest, actix_web, etc. Makes it easier to pass the client around.There's another strong argument towards this: if you wrap your client into
Arc
, you lose all the generated traits implementations from jsonrpsee proc macros.The text was updated successfully, but these errors were encountered: