Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
benchmark: update undici benchmark
  • Loading branch information
Chenyu Yang committed Nov 9, 2023
commit 6a67c0289e8feb594a4a0cc26bdc542e18c20a31
9 changes: 6 additions & 3 deletions benchmark/websocket/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ function createFrame(data, opcode) {
}

function main(conf) {
const frame = createFrame(Buffer.alloc(conf.size).fill('.'), 1);

const frame = createFrame(Buffer.alloc(conf.size).fill('.'), conf.useBinary === 'true');
Comment thread
Ch3nYuY marked this conversation as resolved.
Outdated
Comment thread
Ch3nYuY marked this conversation as resolved.
Outdated
const server = http.createServer();
server.on('upgrade', (req, socket) => {
const key = crypto
Expand Down Expand Up @@ -91,10 +90,14 @@ function main(conf) {
server.listen(8080, () => {
const ws = new WebSocket('ws://localhost:8080');

ws.addEventListener('open', () => {
bench.start();
});

ws.addEventListener('message', (event) => {
ws.send(event.data);
});
});

bench.start();

}
Comment thread
Ch3nYuY marked this conversation as resolved.