Prevent other people from emitting socket info

I have my node socket server running on the same VPS as my website is. Is there a way I can prevent other "websites" or other node projects from connecting to my socket server and emitting data?

My website and node project have the same IP address.

For example: (client side html)

<script>
  var socket = io.connect('localhost') //localhost as an example
  socket.on('example', function(data) { 
     console.log(data) ;
  });
  socket.emit('sendToServer', 'hello world');
</script>

I want this code right here to only be usable by my website (or IP)

EDIT: If there isnt any to do this within socket.io, is there a way I can authenticate my socket server to make it so only my IP can emit things

If you're that concerned about it, you should consider only allowing authenticated users. Otherwise trying to ban explicit IP addresses and maintaining that list isn't very feasible.