Open
Description
- I have looked for existing issues (including closed) about this
Feature Request
Motivation
https://developer.chrome.com/docs/web-platform/early-hints
Early Hints is a method for returning a list of resources to the client before actually sending back the actual response to their query.
This will help with performance on heavier SSR websites.
Proposal
enum EarlyHint {
Preconnect(String),
Script(String),
Style(String),
}
async fn send_early_hint(hints: Vec<EarlyHint>) {
// ... use tokio::spawn etc. to send off a HTTP 103 Early Hint Response
// While the body of the handler function (after this await)
// calls a billion databases to generate the HTML
}
// example
send_early_hint(vec![
EarlyHint::Style("/main.css".into()),
EarlyHint::Script("/main.js".into()),
EarlyHint::Preconnect("https://fonts.google.com".into()),
]).await;