OverviewΒΆ
CNP batch requests and the simplicity of parsing CNM could be combined to provide an equivalent of HTTP/2 server push and provide embedded content within the same round-trip that requests the page itself.
The general idea is to have the client specify a request parameter (e.g. accept_push
) with a list of embedded types, maximum counts and maximum sizes that it will accept in the server push. The server then parses the CNM page, looking for embed
blocks, and adds the content of any that match the client's parameter to a batch response.
If the request was a batch request, the server push batch response is merged with the regular batch response. Any embedded content that was already requested in the batch request without a selector is not pushed.
As usual, the client may close the connection after reading only a part of the entire batch response (for example, after finding a pushed response that does not match its parameters).
The benefits of server push are most notable in situations where establishing a new connection with all TCP and TLS round trips takes too long, such as satellite connections or mobile data links with poor signal. Otherwise, a simple request for the page followed by a batch request for embedded content could be sufficient.
Using caching parameters like if_modified
would also not be possible without a more complicated implementation of server push.