-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: add accept
and reject
functions to upgrade
hook interface for more explicit auth flow
#90
base: main
Are you sure you want to change the base?
Conversation
I appreciate the proposal and PR. Going with a more explicit flow is a good idea. However I think in order to be more explicit, we should avoid callbacks with side-effects ( I suggest instead of Current support of |
What about the responses that need to be sent through the socket? Youll notice for the node adapter for example the response is not being sent back as a close after the upgrade, this was done so the Client gets clear context and data as the why the upgrade was rejected, but I am generally of the opinion that for unauthorized requests the server should do as little work to reject as possible. I personally love the idea of keeping it response native, I think that would be best, I just want to make sure its a good experience. |
I quite like the Perhaps we can split it into smaller PRs to progress? Starting with |
So Here is the thing I'm wondering if we should transition the other adapters to ALSO accept the socket before closing with the clear code, do you think that is worth it for getting clear close frame information on the client? |
ideally there should no be difference in API and behqvior between runtimes that’s what mainly matters to me. Let’s in step one, support throwables for abortion. In next steps we can support createWebSocketError() that can be exceptionally handled in Node (and potentially others that support) to send clear abort frame. |
Sounds good to me, I'll create a set of smaller PRs starting with that first one. |
Related #88
This PR is intended to discuss the interface for the upgrade hook, as it stands right now the usage can be a bit ambiguous, this PR shows what I think is a simpler flow for most people to understand, while also allowing for easier integrations in different environments.
in this example
socket
is just an object containing two functions, intended to execute callbacks specific to the adapter they are supportingIE Bun:
This is just an example of what I think would provide a better user experience/easier integration into frameworks.