-
Notifications
You must be signed in to change notification settings - Fork 331
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
Define the WebSocket client handshake in terms of Fetch #236
Conversation
@mikewest could you review this? @domenic should Fetch abstract the entire WebSocket protocol or should HTML reference a mixture of Fetch and the WebSocket protocol? That is, should Fetch reintroduce the hooks HTML needs, perhaps even putting the security limitations on them directly so HTML no longer needs to do that. I think I have a slight preference for that, but it would be a larger change. |
This looks much less painful than anticipated. The need for "obtain a WebSocket connection" being overridden isn't completely clear. Why is step 1 omitted? And why is resource name excluded?
I'm not really clear what the difference would be, concretely, but in the abstract wrapping everything in fetch sounds a bit nicer. On the other hand, there are a lot of concepts in [WSP] referenced by HTML, and if these two are the only ones you need to override, then just having a no-op forwarding layer between Fetch and WSP would be a bit annoying. |
Note that "establish a WebSocket connection" in the RFC is the process of obtaining a connection, coupled with sending a client handshake request and validating the response. It's all things intertwined. Fetch starts out with the request and does things with that, and then at some point obtains a connection. The layering is different.
Step 1 is omitted because we already validated the input. Resource name is not actually used to obtain a connection. It's used for the handshake that is separately overridden (the larger section with all the header appending).
I think I would import some of the subsetting that HTML does around error handling. But yes, there would be some forwarding too. |
Ah, I see, the structure of that plaintext document makes it hard to understand. OK then. |
This looks good, thank you Anne. Some thoughts:
Otherwise, LGTM. |
|
Fixes #235.