Answer the question
In order to leave comments, you need to log in
Socket.io - How to prevent users from accessing a specific channel on the server?
There is a socket.io server. There are client and server channels.
On the client side, we listen to the client channel.
There is also Elaphant.io.
When certain events occur on the server, we send a message through the elephant to the server channel. Where, in turn, the socket.io server broadcasts this message to all listeners on the client channel.
But I can easily (anyone can) write from the client io.emit('server', 'привет медвед');
what, in turn, will be sent to the server, and the server will send it to everyone.
I have a question. can I somehow connect via the server channel only from the server's localhost? and ban others
Answer the question
In order to leave comments, you need to log in
The simplest thing is to send the secret key. If you delve into it, I think that you can watch the sender's IP during the handshake.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question