mirror of
https://github.com/notherealmarco/vue-quic-test.git
synced 2025-05-05 04:28:39 +02:00
Fix total requests counting
This commit is contained in:
parent
645bb8a6df
commit
219dec465e
1 changed files with 8 additions and 3 deletions
11
src/App.vue
11
src/App.vue
|
@ -12,7 +12,7 @@ onMounted(() => {
|
|||
|
||||
setTimeout(async function () {
|
||||
while (count.value < 30 && proto !== "h3") {
|
||||
console.log(count.value)
|
||||
console.log("Sending request " + count.value)
|
||||
|
||||
const response = await fetch("/?id=" + Math.floor(Math.random() * 1000000));
|
||||
|
||||
|
@ -20,18 +20,23 @@ onMounted(() => {
|
|||
count.value++
|
||||
}
|
||||
|
||||
count.vaule = 0
|
||||
count.value = 0
|
||||
|
||||
console.log("Analyzing requests...")
|
||||
|
||||
performance.getEntries().forEach(entry => {
|
||||
if (entry.nextHopProtocol !== undefined) {
|
||||
if (entry.nextHopProtocol === "h3" && entry.transferSize > 0) h3_count.value++
|
||||
|
||||
if (entry.transferSize > 0) count.vaule++
|
||||
if (entry.transferSize > 0) count.value++
|
||||
|
||||
if (entry.nextHopProtocol !== "") proto = entry.nextHopProtocol
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
console.log(count.value + " requests sent, " + h3_count.value + " used QUIC")
|
||||
|
||||
if (proto === "h3") proto = "HTTP/3"
|
||||
else if (proto === "h2") proto = "HTTP/2"
|
||||
else if (proto === "h2c") proto = "HTTP/2"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue