Answer the question
In order to leave comments, you need to log in
How to secure socket.io from outside connections as much as possible?
How can I secure the io socket as much as possible from outside connections? That is, so that dofiga smart users could not connect to the socket, and access was only when connecting from the site.
Answer the question
In order to leave comments, you need to log in
As an option, send something to the server, which will allow you to check if the user is authorized or not.
Customer
let socket = new io("http://localhost:7777", { query: "id=123" });
io.on("connection", socket => {
let id = socket.handshake.query.id;
console.log(id) // 123
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question