-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(examples): add some examples to track the memory usage
Related: fc21c4a
- Loading branch information
1 parent
fc21c4a
commit 8955eb7
Showing
11 changed files
with
806 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.pem | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Socket } from "engine.io-client"; | ||
import { X509Certificate } from "crypto"; | ||
import { readFileSync } from "node:fs"; | ||
import { WebTransport } from "@fails-components/webtransport"; | ||
|
||
const cert = readFileSync("./cert.pem"); | ||
const CLIENTS_COUNT = 100; | ||
|
||
global.WebTransport = WebTransport; | ||
|
||
for (let i = 0; i < CLIENTS_COUNT; i++) { | ||
const socket = new Socket("ws://localhost:3000", { | ||
transports: ["webtransport"], | ||
transportOptions: { | ||
webtransport: { | ||
serverCertificateHashes: [ | ||
{ | ||
algorithm: "sha-256", | ||
value: Buffer.from( | ||
new X509Certificate(cert).fingerprint256 | ||
.split(":") | ||
.map((el) => parseInt(el, 16)) | ||
), | ||
}, | ||
], | ||
}, | ||
}, | ||
}); | ||
|
||
socket.on("open", () => {}); | ||
|
||
socket.on("message", () => {}); | ||
|
||
socket.on("close", (reason) => {}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
openssl req -new -x509 -nodes \ | ||
-newkey ec -pkeyopt ec_paramgen_curve:prime256v1 \ | ||
-days 14 \ | ||
-out cert.pem -keyout key.pem \ | ||
-subj '/CN=127.0.0.1' |
Oops, something went wrong.