Answer the question
In order to leave comments, you need to log in
How to connect to WS server using hamachi?
I'm trying to organize a node.js WebSocket server (not big, for a couple of devices). I don't want to pay for a white IP, even more so for a VPN. I decided to try to combine devices using a program to create a small VPN for several hamachi devices. For the server, I use the ws module. The code
const WebSocket = require("ws");
const port = 9100;
const server = new WebSocket.Server({port: port});
const onConnect = client => {
console.log("Connection!");
client.send('Connection!');
const onMsg = msgStr => {
try {
client.send(msgStr);
} catch (e) {
console.error(e);
}
};
client.on("message", onMsg);
client.on("close", () => console.log("User disconnect!"));
};
server.on("connection", onConnect);
console.log("Сервер запущен на порту: " + port);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question