title: Problems trying to subscribe in a MQTT topic - Angular 5
body: <p>I'm trying to subscribe in a MQTT topic with Angular 5, I'm using ng2-mqtt.
  After creating my client i try to connect, and it's when the problems start. I'm getting this error: <strong>AMQJS0012E Invalid type undefined for onSuccess</strong></p>
  
  <p>Does anyone knows what i'm doing wrong?</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  
  
  import {Paho} from 'ng2-mqtt/mqttws31';
  
  
  
  @Component({
    selector: 'app-chart',
    templateUrl: './chart.component.html',
    styleUrls: ['./chart.component.css']
  })
  export class ChartComponent implements OnInit {
  
    client;
  
    constructor(){}
  
    ngOnInit() {
      this.client = new Paho.MQTT.Client('m2m.eclipse.org', 1883, 
      '_32fc96dd776142e6ba1a95116d09064f');
  
      this.client.connect({onSuccess: this.onConnected()})
    }
  
    onConnected() {
      console.log("Connected");
      this.client.subscribe("/cmd1234")
    }
  
   }
  </code></pre>
  
  <p>Here is my browser console:
  <a href="https://i.stack.imgur.com/ETbRl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ETbRl.png" alt="enter image description here"></a></p>