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
I'm implementing a websocket jsonrpc server. I'm planning to do some sort of authentication using the on_connect middleware. In case of authentication failure, the request should be rejected, no further websocket connection should be opened. Can we add some sort of "return code" to the on_connect middleware function to decide whether the request should be accepted?
The text was updated successfully, but these errors were encountered:
The HttpMiddleware/WsMiddleware should probably be named something different (see #843); they are unable to modify the request/response and really just exist to allow for basic logging and metric gathering.
We will soon be supporting the tower::Service trait on our Http Server soon (see #841); this may be a better place to add such authentication (assuming you would be happy running the HTTP and not WS server, at least. In the future I'd like to see more "proper" middleware support like this added (probably based on this Service trait), but they aren't a high priority for us at the mo.
My suggestion at the moment would be to add any authentication stuff separately in front of your jsonrpsee server, if the http trait wouldn't be sufficient. It should be possible for you to capture and do whatever you like within coming http/ws requests before they hit Jsonrpsee, albeit more effort than plugging in osme middleware to do the same :)
I'm going to close this for now; it's not something we have any plans to implement (but we have clarified the naming of that middleware and landed "proper" http middleware.
I'm implementing a websocket jsonrpc server. I'm planning to do some sort of authentication using the
on_connect
middleware. In case of authentication failure, the request should be rejected, no further websocket connection should be opened. Can we add some sort of "return code" to theon_connect
middleware function to decide whether the request should be accepted?The text was updated successfully, but these errors were encountered: