Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket sinks #2414

Open
vytas7 opened this issue Dec 2, 2024 · 0 comments
Open

WebSocket sinks #2414

vytas7 opened this issue Dec 2, 2024 · 0 comments

Comments

@vytas7
Copy link
Member

vytas7 commented Dec 2, 2024

It seems that using sinks to match a WebSocket request is currently undocumented, and it leads to sloppy behaviour/mismatched typing, although it surprisingly works, in a sense. But the sink then receives a ws object instead of resp, so a sink method that is unaware of the possibility will likely just error out when trying to set unexpected attributes on ws.

A decision is needed how we want this to work, and what can be considered a fix, and not a breaking change.
OTOH, we have clearly documented the sink callable in add_sink() as taking req and resp parameters, so I think we can afford some redesign here. Alternatively, we could add a flag governing this behaviour.

One way to architect this is to add a ws parameter along the lines of App.add_error_handler(). However, sinks can accept arbitrary **kwargs...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant