Open SylvainGantois opened 3 hours ago
I'm not sure we want a hook that allows users to write arbitrary code before we have a well-formed hub protocol message. I think we can instead improve the telemetry here and provide specific hooks for when methods don't exist. We don't want to expose all of the internal book keeping that SignalR does here as it restricts us from making certain optimizations.
Would that be possible for deserialization issues too? We do constructor validation to prevent any invalid object to be constructed and while that works for HTTP we cannot catch those issues with SignalR (calls with a deserialization issue will fail early with the hub dispatcher).
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
When using web sockets, hub method invocations will silently fail in production if the request is invalid for one of the following reasons:
In DEBUG mode we have such log:
This is a problem because we cannot
The common solution to add middleware to the pipeline is via hub filters, but those run after the hub dispatcher, meaning they will never run in case of bad request.
Describe the solution you'd like
The ability to run code before the hub dispatcher (or anywhere before the request failure, I do not know all the details of what happens before the hub filters), which would allow to implement extra behaviours (rate limiter, invocation logging, ...) even if the request is malformed.
Additional context
No response