Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
APP_ENV=local
APP_TOKEN=$2y$10$9z/ch9hTc5rNQF9ks7cQoui5ISEeTCa73Ixm3c2UiJawY33WrnuuG

SERVER_PORT=25053
SERVER_IP=127.0.0.1
DEFAULT_PONG_INTERVAL=3000
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/node_modules
.env
10 changes: 6 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const net = require("net");
require('dotenv').config();

const net = require('net');
const client = new net.Socket();

const token = '$2y$10$9z/ch9hTc5rNQF9ks7cQoui5ISEeTCa73Ixm3c2UiJawY33WrnuuG';
const token = process.env.APP_TOKEN;

client.connect(25053, "127.0.0.1", () => {
client.connect(process.env.SERVER_PORT, process.env.SERVER_IP, () => {
console.log("Connected");
client.write("AUTHENTICATION=" + token, "utf8");
});
Expand All @@ -20,4 +22,4 @@ setInterval(() => {
let sent = "Pong ...";
client.write(sent);
console.log("Send: " + sent);
}, 3000);
}, process.env.DEFAULT_PONG_INTERVAL);