hyperjump-io/browser

"Push" support

Closed this issue · 1 comments

HTTP/2 defines a feature called "server push". It allows a response to include additional responses to requests that it anticipates will be made. For example, if you are serving an HTML page, it's almost certain that the browser is immediately going to make a request for the CSS file that is linked in the HTML. Therefore, it makes sense to send that CSS in anticipation of that request to eliminate that request.

The purpose of the $embedded keyword is to solve the same kind of problem. If a document has an $href, the browser must make an additional request to get the referenced document. We can reduce the number of requests by inlining the $href using $embedded. This approach has some consequences regarding caching, but we'll ignore that for now.

This feature should add two functions: push and pull. push should take a document and a URL. If an $href to that URL exists in the document, it should be inlined with $embedded. pull should take a document and a URL. If an $embedded for that URL exists in the document, it should be pulled out and replaced with the equivalent $href.

Not sure what I was thinking here 😕. "Server push" is a server feature and Hyperjump is a client.