text: Q:
  
  MQTT 1884 connection failed
  
  I am using mqtt for a messaging system on my site. Well on my local machine everything works fine but on my site (production) I am getting an error: 
  
  vendor.bbaf8c4….bundle.js:1 WebSocket connection to
    'ws://localhost:1884/mqtt' failed: Error in connection establishment:
    net::ERR_CONNECTION_REFUSED
  
  I am using Ubuntu within my Webserver and I gave the port 1884 free.
  What this error meaning?
  I am using Angular4 and I add the connection within AfterViewInit
  ngAfterViewInit() {
      setTimeout(()=>{
  
          this.messageservice.createMqttConnection(this.userId);
      }, 200)
  
  }
  
  The connection with Paho on my client site looks like:
    this._client = new Paho.MQTT.Client("localhost", 1884, id.toString());
  
  Let assume my domains is mydomain.com should I replace it with localhost?
  
  A:
  
  As thrashed out in the comments:
  The hostname in your app needs to point to your domain e.g. mydomain.com not localhost
  localhost will always point to the machine the code is running on so is very unlikely to be what you want for a production deployment of an application.
  
  