title: Web client was not able to connect to the MQTT web socket
body: <p>I have created a MQTT broker, and I have configured a web socket.
  This is my configuration file. (I don't use SSL)</p>
  
  <pre><code>#mqtt
  listener 1883
  protocol mqtt
  
  #Websockets
  listener 9001
  protocol websockets
  </code></pre>
  
  <p>I running my MQTT broker (with this command <code>$ mosquitto -c /path/to/mosquitto.conf</code>) and this is the log file.</p>
  
  <pre><code>1569230648: mosquitto version 1.4.15 (build date Tue, 18 Jun 2019 11:42:22 -0300) starting
  1569230648: Config loaded from /etc/mosquitto/mosquitto.conf.
  1569230648: Opening ipv4 listen socket on port 1883.
  1569230648: Opening ipv6 listen socket on port 1883.
  1569230648: Opening websockets listen socket on port 9001.
  </code></pre>
  
  <p>In my web site I have this code.</p>
  
  <pre><code>&lt;!-- Script to import MQTT --&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.js" type="text/javascript"&gt;
  &lt;/script&gt;
  
  
  &lt;!-- Script to connect to MQTT broker and retrieve current values --&gt;
  &lt;script&gt;
  var websocket =  "195.**.***.**"; 
      var port =  9001; 
  
      client = new Paho.MQTT.Client(websocket, port, "web_connection" + parseInt(Math.random() * 100, 10));    
  
      // set callback handlers
      client.onConnectionLost = onConnectionLost;
      client.onMessageArrived = onMessageArrived;
  
  
      var options = {
          onSuccess: onConnect,
          onFailure: doFail
      }
  
      // connect the client
  
      client.connect(options);
      .....
  </code></pre>
  
  <p>But when I try to connect with my web site, Chrome get this error: </p>
  
  <pre><code>mqttws31.js:977 WebSocket connection to 'ws://195.**.***.**:9001/mqtt' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
  </code></pre>
  
  <p>I open in my router 9001 port. Why can't the client web connect?</p>
  
  <p>Thanks</p>