updated socket.io ports logic