From what I understand, what multiplexing means is that the client just need to create one TCP connection with the server and it can send multiple requests at the same time without having to wait for the response of one request before continuing another. So if I send 3 request at the same time, there are also 3 response streams.
And for server push, the client sends one request to the server, the server then guesses that the client needs other resources (also called promises) other than the one it requested, so it sends push promise streams hinting the client with the URL of the additional resources. The client may choose to request those additional resources or not.
My questions are:
- For any response sent from the server to the client, does it have to be a request initiated first? I mean, it I created a connection to the server, I did not send any request. Could I be getting responses from server via server push? In multiplexing, I get same number of responses for same number of requests. In server push, I can get multiple responses for one request. So does there always have to be a request first?
- In server push, when a promise stream is sent by the server to the client containing the URL of the additional resources, does that mean the server will only push the additional resources only when the client accepts the promises?