Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIntegrate websocket connection creation into fetch network stack #14897
Comments
|
Yeah, I will take this. If the websocketconnection is removed from CoreResourceMsg, where would I get the WebSocketCommunicate, and WebSocketConnectData to pass to websocket_connect? Also would I be adding this check inside the thread builder in CoreResourceManager::fetch? |
|
Those are good questions! I propose we add the |
|
Attempting to add fields to the |
|
|
|
Sorry for the constant questions, removing |
|
That's fine! |
|
More specifically, if |
|
I am currently trying the modify the DOM implementation of |
|
Grumble. Ok, let's modify the Fetch message to contain a |
|
Taking a lot at this. Gotta love removing code! |
|
Instead of trying to shoehorn enum FetchCommunicationChannel {
Fetch(IpcSender<FetchResponseMsg>),
WebSocket {
event_sender: IpcSender<WebSocketNetworkEvent>,
action_receiver: IpcReceiver<WebSocketDomAction>
}
}This enum will be sent as part of the arguments for enum CoreResourceMsg {
Fetch(RequestInit, FetchCommunicationChannels),
// other variants...
}That way we wouldn't run into issues when trying to derive Clone, Copy, Send or Sync for |
Merge functionality of WebsocketConnect into Fetch Partial #14897. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18871) <!-- Reviewable:end -->
Merge functionality of WebsocketConnect into Fetch Partial #14897. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18871) <!-- Reviewable:end -->
Merge functionality of WebsocketConnect into Fetch Partial #14897. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18871) <!-- Reviewable:end -->
Merge functionality of WebsocketConnect into Fetch Partial #14897. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18871) <!-- Reviewable:end -->
…atavra Merge functionality of WebsocketConnect into Fetch Partial #14897. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18871) <!-- Reviewable:end -->
|
I believe it's best to wait until #19825 is resolved first before we integrate any further, since hyper seems to have plans for handling WebSocket upgrades as well. |
|
When this work eventually happens, we'll want to be sure that it includes #19266. |
|
Given #21386, I'm not sure if this work is necessary anymore. |
|
If I'm not mistaken, the ws crate seems to have its own implementation of the fetch stack that is opaque to us. |
|
Yeah, I don't see any way to have actual integration with the fetch code. We'll need to duplicate the relevant changes in the code that prepares the HTTP request, unfortunately. |
|
@Eijebong I still think this is impossible, even when we implement our own |
Right now, the DOM implementation of WebSocket sends a special message to the resource thread asking for a websocket connection to a particular URL. #14895 allows us to model the code more like the specification instead, and make the DOM code look like other code that initiates network connections. To start with, let's remove the special case (
WebsocketConnection) fromCoreResourceMsg, and make the resource thread check the request's mode and use the websocket loader if applicable (instead of the regular fetch code).@dowoncha Would you like to do this?