Skip to content

Commit d1ffea0

Browse files
authored
Merge branch 'master' into 6-implement-dotenv-and-env-example
2 parents 0cb2ae3 + 8d74592 commit d1ffea0

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

app.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@ require('dotenv').config();
33
const net = require('net');
44
const client = new net.Socket();
55

6+
const token = '$2y$10$9z/ch9hTc5rNQF9ks7cQoui5ISEeTCa73Ixm3c2UiJawY33WrnuuG';
7+
68
client.connect(process.env.SERVER_PORT, process.env.SERVER_IP, () => {
79
console.log("Connected");
8-
client.write("First Ping ... \n");
10+
client.write("AUTHENTICATION=" + token, "utf8");
911
});
1012

1113
client.on("data", (data) => {
12-
console.log("Received: " + data);
13-
14-
setTimeout(() => {
15-
let sent = "Pong ... \n";
16-
client.write(sent);
17-
console.log("Send: " + sent);
18-
}, process.env.DEFAULT_PONG_INTERVAL);
14+
console.log("Received: " + data + "\n");
1915
});
2016

2117
client.on("close", () => {
2218
console.log("Connection closed");
2319
});
20+
21+
setInterval(() => {
22+
let sent = "Pong ...";
23+
client.write(sent);
24+
console.log("Send: " + sent);
25+
}, process.env.DEFAULT_PONG_INTERVAL);

0 commit comments

Comments
 (0)