title: Mosquitto ERR_CONNECTION_REFUSED using websockets (paho client) on win 10
body: <p>I've read all the threads with similar questions, but couldn't find an answer.</p>
  
  <p>Mosquitto config:</p>
  
  <pre><code>listener 1883 127.0.0.1
  protocol mqtt
  listener 9001 127.0.0.1
  protocol websockets
  </code></pre>
  
  <p>log output:</p>
  
  <pre><code>1567705166: mosquitto version 1.6.2 starting
  1567705166: Config loaded from C:\Program Files (x86)\mosquitto\mosquitto.conf.
  1567705166: Opening ipv4 listen socket on port 1883.
  1567705166: Opening websockets listen socket on port 9001.
  1567705166: Opening websockets listen socket on port 1883.
  </code></pre>
  
  <p>Chrome devtools:</p>
  
  <pre><code>mqttws31.js:977 WebSocket connection to 'ws://127.0.0.1:9001/mqtt' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
  </code></pre>
  
  <p>I've tried many things but nothing helped:</p>
  
  <ol>
  <li>Trying  websockets only</li>
  <li>Trying another port (1883 and 9001 instead of 8080)</li>
  <li>Switching off Windows firewall</li>
  </ol>
  
  <p>If I change the config file to:</p>
  
  <pre><code>#listener 1884 127.0.0.1
  #protocol mqtt
  #listener 1883 127.0.0.1
  protocol websockets
  </code></pre>
  
  <p>Mosquitto listens for websockets on port 1883 but logfile reads:</p>
  
  <pre><code>1567706943: mosquitto version 1.6.2 starting
  1567706943: Config loaded from C:\Program Files (x86)\mosquitto\mosquitto.conf.
  1567706943: Opening websockets listen socket on port 1883.
  1567706943: Error in poll: No error.
  1567706943: Error in poll: No error.
  1567706943: Error in poll: No error.
  1567706943: Error in poll: No error.
  1567706943: Error in poll: No error.
  1567706943: Error in poll: No error.
  1567706943: Error in poll: No error.
  1567706943: Error in poll: No error.
  1567706943: Error in poll: No error.
  1567706943: Error in poll: No error.
  </code></pre>
  
  <p>changing config to:</p>
  
  <pre><code>protocol websockets
  listener 8080 127.0.0.1
  protocol mqtt
  </code></pre>
  
  <p>Gives me a logfile that says:</p>
  
  <pre><code>1567707450: mosquitto version 1.6.2 starting
  1567707450: Config loaded from C:\Program Files (x86)\mosquitto\mosquitto.conf.
  1567707450: Opening ipv4 listen socket on port 8080.
  1567707450: Opening websockets listen socket on port 1883.
  </code></pre>
  
  <p>(no extra crap)</p>
  
  <p>After following up on answer no 1:</p>
  
  <p>config:</p>
  
  <pre><code>protocol websockets
  listener 1883 127.0.0.1
  protocol mqtt
  </code></pre>
  
  <p>console:</p>
  
  <pre><code>WebSocket connection to 'ws://127.0.0.1:1883/mqtt' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
  </code></pre>
  
  <p>log:</p>
  
  <pre><code>1567716915: mosquitto version 1.6.2 starting
  1567716915: Config loaded from C:\Program Files (x86)\mosquitto\mosquitto.conf.
  1567716915: Opening ipv4 listen socket on port 1883.
  1567716915: Opening websockets listen socket on port 1883.
  1567716920: New connection from 127.0.0.1 on port 1883.
  1567716920: Socket error on client &lt;unknown&gt;, disconnecting.
  1567716920: New connection from 127.0.0.1 on port 1883.
  1567716920: Socket error on client &lt;unknown&gt;, disconnecting.
  5492: Error in poll: No error.
  1567715492: Error in poll: No error.
  1567715492: Error in poll: No error.
  1567715492: Error in poll: No error.
  1567715492: Error in poll: No error.
  1567715492: Error in poll: No error.
  </code></pre>
  
  <p>Tried another websockets client (<a href="https://www.eclipse.org/paho/clients/js/utility/" rel="nofollow noreferrer">https://www.eclipse.org/paho/clients/js/utility/</a>) --> Failed to connect: AMQJSC0001E Connect timed out.</p>
  
  <p>I can't get websockets to work with any configuration / port...
  Can anyone confirm that Websockets in Mosquitto (32bit version 1.6.2 or 1.6.4) for Win10 are working ? </p>