Skip to content

Commit a3c0030

Browse files
Delete Eslint script, add label for Socket.io block code
1 parent b8bf32f commit a3c0030

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"scripts": {
88
"start": "nodemon src/index.js",
99
"update-deps": "npx npm-check-updates -u && npm install",
10-
"lint": "eslint",
1110
"test": "echo \"Error: no test specified\" && exit 1"
1211
},
1312
"keywords": [

src/index.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ app.listen(PORT, () => {
3737
console.log(`API Documentation: ${SWAGGER_URL}`);
3838
});
3939

40+
// Socket.io
4041
const server = http.createServer(app);
41-
4242
const io = new Server(server, {
4343
cors: {
4444
origin: "http://localhost:3000",
@@ -47,20 +47,18 @@ const io = new Server(server, {
4747
});
4848

4949
server.listen(4001, () => {
50-
console.log(`Server is listening at 4001`);
50+
console.log(`Socket server is listening at port 4001`);
5151
});
5252

5353
let walletAddress = null;
5454
let listSharkFollowed = [];
5555

5656
io.on("connection", async function (socket) {
57-
// console.log("Someone connected");
58-
57+
console.log("Someone connected");
5958
socket.on("get-wallet-address", async (address) => {
6059
if (address !== null) {
6160
walletAddress = address;
6261
console.log("global", walletAddress);
63-
6462
listSharkFollowed = await getListOfSharkFollowed(walletAddress);
6563
}
6664
});
@@ -74,14 +72,13 @@ InvestorModel.watch([
7472
if (walletAddress !== null) {
7573
for (var shark of listSharkFollowed.datas) {
7674
const newTransactions = await getNewTransactions(shark.sharkId);
77-
78-
if (newTransactions.transactionsHistory.length > 0){
75+
76+
if (newTransactions.transactionsHistory.length > 0) {
7977
io.emit("new-transactions", {
8078
newTransactions: newTransactions,
8179
sharkId: shark.sharkId
8280
});
8381
}
84-
8582
}
8683
}
8784
});

0 commit comments

Comments
 (0)