-
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
Get connection ID in rpc handler #1014
Comments
@niklasad1 AFAIU @xlc would like to contribute some features like this one, can you make sure he gets the help that he needs? |
Like I said before the RPC handler is not exposed by this library by design. #918 would solve this issue as well as some similar issues raised recently. |
I am not 100% following. How is TwoerService going to help? All I need is to make this NOT ignore the connect id parameter jsonrpsee/core/src/server/rpc_module.rs Line 669 in 18ee212
It could be a simple change by adjusting the callback function signature to include connection ID, which will be a breaking change. Or add new register method with callback takes connection ID. |
I am not very familiar with Tower middleware but I don't think it applies here. It is not compatible with websocket frame data. |
Ok, I see that could work.
This won't work because register_method is done at initialization i.e, before the connection is established.
Ok, I will write down a better issue for it but yeah you are correct after the HTTP upgrade is completed. Then we have no use of tower but you could actually fetch the connection ID there and store somewhere/spawn a task in your proxy for each connection. To elaborate it would useful if you could add an example snippet code what you want to do then it we would understand better and could help out better. |
I am thinking interface similar to subscription. Have a sink or a connection object as a parameter to the callback that allow me to retrieve the connection ID & related details and close the connection. The goal is to implement rate limiting feature on RPC methods so I am happy with whatever mechanism that achieves it. |
So that it is possible to rate limit message per seconds per connection
The text was updated successfully, but these errors were encountered: