You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Edit: In practice Chrome only supports 103 Early Hints over HTTP/2, so I realized there is no point in sending Early Hints with the current flash server. I would appreciate it if you could introduce this in the future when HTTP/2 can be used with Deno.serve().
Flash server can return 103 Early Hints response. It's great, but I wish there was a better UX.
// the way i currently doimport{writeAll}from"https://deno.land/[email protected]/streams/mod.ts";constencoder=newTextEncoder();constok=(body: string)=>{const{ byteLength }=encoder.encode(body);consttext=["HTTP/1.1 103 Early Hints","Link: </style.css>; rel=preload","Link: </script.js>; rel=preload","","","HTTP/1.1 200 OK","Content-Type: text/plain",`Content-Length: ${byteLength}`,"",body,"",].map((str)=>`${str}\r\n`).join("");returnencoder.encode(text);};consthandler=(async(req: Request)=>{const[conn,_firstPacket]=Deno.upgradeHttpRaw(req);constres=ok("hello");awaitwriteAll(conn,res);conn.close();})asunknownasDeno.ServeHandler;Deno.serve(handler);
I think it would be great if we could write something like the following instead of the less versatile style above. (And it should also improve performance.)
@ayame113 using cs.github.com I noticed you are the only user of Deno.upgradeHttpRaw. This API is gonna get removed in the next minor release of Deno (though it will start throwing and error in the next patch release). Deno.serve() got rewritten to use Deno.serveHttp() in 2846bbe and I believe this feature would currently not be supported. I'm happy to explore this and hope @mmastrac could chime in
using cs.github.com I noticed you are the only user of Deno.upgradeHttpRaw.
Thank you for letting me know about that!! As I wrote in the comment above, I found that 103 Early Hints cannot be sent with the combination of Deno.upgradeHttpRaw and HTTP/1.1. So I'm not using this anymore so removing this is fine for me.
Edit: In practice Chrome only supports 103 Early Hints over HTTP/2, so I realized there is no point in sending Early Hints with the current flash server. I would appreciate it if you could introduce this in the future when HTTP/2 can be used with
Deno.serve()
.https://chromium.googlesource.com/chromium/src/+/master/docs/early-hints.md#what_s-not-supported
Flash server can return 103 Early Hints response.It's great, but I wish there was a better UX.I think it would be great if we could write something like the following instead of the less versatile style above. (And it should also improve performance.)
For your reference:
The text was updated successfully, but these errors were encountered: