Use this instead of http://localhost:PORT on your frontend var ip = '127.0.0.1:YOUR_PORT';
var socket = io.connect(ip);