After I add the --origin-to-force-quic-on=localhost:443 argument for the Chrome launcher, all connections (navigation ones included) start to trigger the QUIC endpoint on my server. That’s totally fine for my project’s goals but I cant find any example on how to process such navigation connections. I’m navigating to https://localhost and my Deno server code looks like this:
import SSL from './SSL.js'
const enc=new TextEncoder,
dec=new TextDecoder
for await(const conn of new Deno.QuicEndpoint({port:443}).listen({alpnProtocols:['h2','h3'],...(SSL.default??SSL)})){
for await(const {writable,readable} of conn.incomingBidirectionalStreams){
for await(const data of readable) console.log(dec.decode(data))
const writer=writable.getWriter()
await writer.write(enc.encode('Hello World!'))
writer.close()
}
}
In this code I’m just trying to read everything that Chrome is sending to me and then respond on everything with Hello World!. However it does not work from both ends.
First problem is that I cannot decipher what Chrome is sending to me. Byte arrays that my server is receiving look like this:
Uint8Array(451) [
1, 65, 192, 0, 0, 209, 80, 134, 160, 228, 29, 19,
157, 9, 215, 193, 228, 47, 0, 65, 72, 177, 39, 90,
209, 255, 184, 254, 116, 157, 63, 220, 63, 119, 108, 29,
82, 127, 63, 125, 224, 254, 94, 254, 126, 148, 254, 111,
79, 97, 233, 53, 180, 255, 63, 125, 224, 254, 66, 203,
223, 207, 210, 159, 206, 35, 158, 106, 10, 165, 233, 236,
61, 37, 254, 126, 251, 193, 252, 133, 151, 191, 159, 47,
4, 65, 72, 177, 39, 90, 209, 173, 73, 227, 53, 5,
2, 63, 48, 47,
... 351 more items
]
Chrome is sending 3 exactly the same byte arrays and then closing his writable stream. These bytes clearly cannot be translated into Unicode and when new TextDecoder is used upon them – output is gibberish. So what should I do with these byte arrays and what is their purpose?
Second problem is that I do not understand what Chrome is expecting from me in return. I thought that the browser whould wait to recieve an HTML code to draw it on the browser’s screen however when I send an encoded Hello World! and close my writable stream the connection with my server immediately terminates with ERR_QUIC_PROTOCOL_ERROR. So what exactly should I send to the browser in return?

