Replies: 1 comment
-
Chatted with @dignifiedquire, a few key points from that discussion: Wrapping existing protocols is the solution we recommendWe already have code that does exactly this: the We can't put middleware between the protocol and the endpoint because With that said, this leaves the router that wraps ProtocolHandlers internally on the table. We can write a custom router that accepts a single screening function, and wraps all protocols with it. We should write more example routersMy recommended remedy is to ship more examples, and later consider if one of these routers becomes used commonly enough to give it a separate crate. The Recommendations:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
There are two major use cases for wanting to hook into the connection lifecycle before connection construction is passed to
ProtocolHandler.on_connecting
:Both could operate off a hook with the same function signature as
on_connecting
, It would just need to be called before being passed to a protocol handlerAdvantages
It would be really nice to have an endpoint on-off switch.
Drawbacks
Endpoint
API, which is a big deal. Given that most folks will probably want this to be the place where they do access-token based access control, they'll likely be left feeling sad that this middleware doesn't go far enough.Alternatives
ProtocolHandlers
.Beta Was this translation helpful? Give feedback.
All reactions