SignalR - Ability to run middleware before the hub dispatcher
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### 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:
- method does not exist
- type mismatch
- missing parameter
- ...
In DEBUG mode we have such log:

This is a problem because we cannot
- rate limit the bad method invocations
- log such method invocation (a bad client could continuously make bad requests and they would be invisible)
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_
Contributor guide
Assessment
This issue has not been assessed yet.