javascript - Prevent other people from emitting socket info -
i have node socket server running on same vps website is. there way can prevent other "websites" or other node projects connecting socket server , emitting data?
my website , node project have same ip address.
for example: (client side html)
<script> var socket = io.connect('localhost') //localhost example socket.on('example', function(data) { console.log(data) ; }); socket.emit('sendtoserver', 'hello world'); </script>
i want code right here usable website (or ip)
edit: if there isnt within socket.io, there way can authenticate socket server make ip can emit things
if you're concerned it, should consider allowing authenticated users. otherwise trying ban explicit ip addresses , maintaining list isn't feasible.
Comments
Post a Comment