I would rather this be:

  PORT = #{port} || document.location.port

That way you can just set the `client_port` to null and it will fallback to use the port of the document