title: Paho javascript client + mosquitto Websockets + Tls
body: <p>I've beend trying to add security layers for mosquitto broker for a while now and I need some help.</p>
  <p>I configured my broker with this configuration :</p>
  <pre><code>...
  #logs
  
  
  #authentication
  
  password_file /etc/mosquitto/passwd
  allow_anonymous false
  
  #user
  user mosquitto
  
  #broker settings
  require_certificate false
  listener 8081
  protocol websockets
  http_dir /var/www/html
  keyfile /etc/mosquitto/certs/mqtt-server.key
  certfile /etc/mosquitto/certs/mqtt-server.crt
  cafile /etc/mosquitto/ca_certificates/mosquitto-certificate-authority.crt
  
  </code></pre>
  <p>This is what the log outputs:</p>
  <pre><code>1631281308: mosquitto version 2.0.12 starting
  1631281308: Config loaded from /etc/mosquitto/mosquitto.conf.
  1631281308: Opening websockets listen socket on port 8081.
  1631281308: mosquitto version 2.0.12 running
  </code></pre>
  <p>I generated my certificates acording to this site: <a href="https://www.raspberrypi.org/forums/viewtopic.php?t=287326" rel="nofollow noreferrer">https://www.raspberrypi.org/forums/viewtopic.php?t=287326</a>. I believe it's not a problem with the certificates as everything went right when testing with mosquitto-clients (commenting the protocol websockets on .conf file).</p>
  <p>I uploaded a test code from this site <a href="https://jpmens.net/2014/07/03/the-mosquitto-mqtt-broker-gets-websockets-support/" rel="nofollow noreferrer">https://jpmens.net/2014/07/03/the-mosquitto-mqtt-broker-gets-websockets-support/</a> on my nginx service to test the connection with secure websockets but all it gives me is &quot;Connection failed: AMQJS0007E Socket error:undefined.Retrying&quot;.</p>
  <p>Can you guys help me out please?</p>