You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After trying to "share state" between different layers of the middleware in jsonrpsee, which is hard to
do properly.
One possibility is to inject a shared state such as Arc<Mutex<HashSet<(RequestId, MethodName, Params)>>> but it's not a good solution because the RequestId isn't necessarily unique, and it's possible that an identical RPC call may overwrite a pending call or something similar.
For instance, my own use case is that I would want to know whether a call was rate-limited or not, which was controlled by another middleware layer.
A good solution is to copy what hyper/http has for the Request/Response in the http::Extensions API so that one could just inject custom data in there, as in the following example:
After trying to "share state" between different layers of the middleware in jsonrpsee, which is hard to
do properly.
One possibility is to inject a shared state such as
Arc<Mutex<HashSet<(RequestId, MethodName, Params)>>>
but it's not a good solution because the RequestId isn't necessarily unique, and it's possible that an identical RPC call may overwrite a pending call or something similar.For instance, my own use case is that I would want to know whether a call was rate-limited or not, which was controlled by another middleware layer.
A good solution is to copy what hyper/http has for the Request/Response in the http::Extensions API so that one could just inject custom data in there, as in the following example:
The text was updated successfully, but these errors were encountered: