Cannot use authentication and subscription
If I use the authentication example and add subscription to it, the subscription doesn't work, as it reaches https://github.com/paritytech/jsonrpsee/blob/c9e26b04b1eb627e280657214ab7227f8d688267/server/src/middleware/rpc/layer/rpc_service.rs#L115 this line of code.
It seems that having any FromRequestExtensions usage in the router breaks subscriptions.
I was able to work around it by using 2 routers, one with HTTP and authentication, and the other WS and no authentication.
I'm afraid that I'm having trouble reproducing this, are you able to give a code example of a router where it happens?
I added the following handler:
#[handler(subscription)]
async fn my_sub(ctx: AuthCtx) -> impl Stream<Item = usize> {
stream::iter([1, 2, 3])
}
#[tokio::main]
async fn main() {
// Create the qubit router
let router = Router::new()
// ...
.handler(my_sub);
// ...
}
and tried using it from the authentication demo:
api.my_sub.subscribe((n) => console.log("after sub", n));
and it works as expected, so long as the subscription is called after the user is authenticated with the cookie.
I'm sorry for not posting the issue with the repro in the first place. I'll create one.
I'm going to close this issue out for now, but feel free to re-open if you're still facing this issue.