Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
server: Register raw method with connection ID #1297
server: Register raw method with connection ID #1297
Changes from 24 commits
26ec635
ef24148
4f8eb03
9eba899
239cafe
0de6d95
4ce51c6
5f2b40a
753224a
d526b70
c8ff969
b4880b9
d2da4b0
0dc48e9
0029418
3a09a7e
1565927
f5202ef
8cf1947
bd571e1
04dfd25
e02ba61
7b72d8a
87585ad
2c50375
66b6a39
cfe1aec
7327d8b
6605409
650e24a
f4d9085
40d2bcf
8185193
11ef18c
4f459ac
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we need the builder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
RpcService
should be the last "layer" before the user-callback is called.We construct the
ConnectionDetails
in this layer:jsonrpsee/server/src/middleware/rpc/layer/rpc_service.rs
Lines 102 to 104 in 87585ad
I think we could just as easily provide a constructor for this:
The
new
method needs to be public, because the ConnectionDetails is declared in thecore
crate. And theConnectionDetails
needs to be instantiated in theserver
crate as well.We'd have to eventually change this method to
new(id: ConnectionId, extensions: Extenstions)
which will be a breaking change (although we should be the only ones building this object).TLDR; since we'll do a breaking change either way, I think a
new
method should be fine for now! 🙏There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I see makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe have it be
#[doc(hidden)]
and comment that it's not part of the public APi and can change without notice? I don't think anything outside ofjsonrpsee
needs to build it, so then we could also just usenew()
instead of a builder (Or maybe eg_new(connection_id)
to really emphasise the hiddenness of it but shrug)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not super happy about the naming
register_async_with_details
, it's too vague for my taste.I would prefer
register_async_method_with_conn_context
or something like thatIt should be obvious whether it is a method call or subscription IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
register_async_method_eith_details
? since we are proviginConnectionDetails
to it, so the word details lines up well imo :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have changed it to
server_wtih_connection_details
, thanks!Check warning on line 169 in proc-macros/src/render_server.rs
GitHub Actions / clippy
this `else { if .. }` block can be collapsed
Check warning on line 169 in proc-macros/src/render_server.rs
GitHub Actions / clippy
this `else { if .. }` block can be collapsed
Check warning on line 169 in proc-macros/src/render_server.rs
GitHub Actions / clippy
this `else { if .. }` block can be collapsed