-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
32 lines (27 loc) · 848 Bytes
/
Copy pathtest.js
File metadata and controls
32 lines (27 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const io_client = require("socket.io-client");
const port = 9000;
const url = `http://localhost:${port}`;
console.log(`Connecting to ${url}`);
const socket = io_client.connect(url);
let transaction1 = {from: "C1", to: "C2", amount: 0, desc: "description"};
const max = 1000000;
let amount = 1;
let desc = 'hahaha';
const increment = 10;
socket.on("connect", () => {
let timer = setInterval( () => {
console.log(`Current amount: ${amount}`);
transaction1.amount = amount;
transaction1.desc = desc;
socket.emit("transaction", JSON.stringify(transaction1));
if (amount === max) {
console.log("END OF BENCHMARKING");
clearInterval(timer);
process.exit(0);
}
else {
amount *= increment;
desc += desc;
}
}, 200);
});