I have a specific problem. I am trying to implement the mqtt.js library in angular2 with typescript. Here's my app.component.ts:

```
import { Component } from '@angular/core';
import * as mqtt from 'mqtt';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
 private client: mqtt.Client;
  ngOnInit(): void {
    this.connectToMQTTBroker();
  }
  public connectToMQTTBroker () {
    console.log('trying to connect');
    this.client  = mqtt.connect('ws://mqttBroker.de:1882');
    this.client.addListener('connect', this.on_connect);
    this.client.addListener('message', this.on_message);
  }

  private on_connect () {
    console.log('connected');
    this.client.subscribe('/broker/response/clientID');
    this.client.publish('/providers', '{...Message...}' );
  }

  private on_message (args: any[]) {
    console.log(args[0]);
    console.log(args[1]);
  }
}

```

It connects succesfully, I see the 'connected' message in the log, but then I get `Cannot read property 'subscribe' of undefined`

Why is the client variable not accessible in the on\_connect method? I am pretty sure I am missing some basic Typescript stuff, but I just cannot figure out what.