title: Paho JS can't connect to Mosquitto Server
body: <p>When I try to connect to Mosquitto server through this JS, I receive this error:</p>
  
  <pre><code>WebSocket connection to 'ws://xx.xxx.xxx.xxx:1883/mqtt' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET 
  </code></pre>
  
  <p>I tried from console and it works fine.
  I tried with Java client as provider and consumer and it works fine.
  So I can't undertand what should I do to have it working.</p>
  
  <p>This is JS:</p>
  
  <pre><code>client = new Paho.MQTT.Client("xx.xxx.xxx.xxx", 1883, "clientId");
  
  client.onConnectionLost = onConnectionLost;
  client.onMessageArrived = onMessageArrived;
  
  // connect the client
  client.connect({onSuccess:onConnect});
  </code></pre>
  
  <p>This is Java (working):</p>
  
  <pre><code>@Stateless
  @LocalBean
  public class PahoManager implements MqttCallback {
  
    MqttClient client;
  
    public void init() {
        try {
            client = new MqttClient("tcp://192.168.50.10:1883", "pahomqttpublish1");
  
            client.connect();
            client.subscribe("pahodemo/test");
        } catch (MqttException e) {
            e.printStackTrace();
        }
    }    
  
    public void doDemo()  {
      try {
  
        MqttMessage message = new MqttMessage();
        message.setPayload("Ciao Pluto".getBytes());
        client.publish("pahodemo/test", message);
  
        //client.disconnect();
      } catch (MqttException e) {
        e.printStackTrace();
      }
    }
  
      @Override
      public void connectionLost(Throwable thrwbl) {
          System.out.println("Connection Lost");
      }
  
      @Override
      public void messageArrived(String string, MqttMessage mm) throws Exception {
          System.out.println("Message: " + string + mm);
      }
  
      @Override
      public void deliveryComplete(IMqttDeliveryToken imdt) {
          System.out.println("Message delivered");
      }
  }
  </code></pre>