title: MQTT instead of wss on browser
body: <p>When I run this code with nodejs, it works fine both on wss(code commented) and mqtts protocol. However if I run this on browser, it only works with wss. I tried bundling with browserify; I tried using cdn but no luck with mqtt protocol. I want to use mqtt protocol because data is not realtime in wss protocol.</p>
  <pre><code>const mqtt = require('mqtt');
  const client = mqtt.connect(&quot;mqtts://mqtt.some.com&quot;, {
      username: &quot;some&quot;,
      password: &quot;somepassword&quot;,
      port: 8883,
  });
  
  // const client = mqtt.connect(&quot;wss://mqtt.some.com&quot;, {
  //   username: &quot;some&quot;,
  //   password: &quot;somepassword&quot;,
  //   port: 8083,
  // });
  
  client.on('connect', () =&gt; {
      console.log('connected');
      client.subscribe('body_data/1/91', { qos: 1 })
  });
  
  client.on('message', function (topic, message, packet) {
      console.log(&quot;=====================================================================&quot;);
      console.log(message.toString(), new Date(Date.now()).toUTCString());
  });
  </code></pre>
  <p>Here's the error I get when running mqtt protocol on browser
  <a href="https://i.stack.imgur.com/7Ccqr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Ccqr.png" alt="mqtt error" /></a></p>