title: angular8 signalr received message wont set variable
body: <p>I have writter simple signalr with .net core web api + angular 8</p>
  <p>it works fine with api and sends to clients the message that is being sent yet the very weird part is that it wont set the variable in angular inside the received method of it</p>
  <pre><code>  import { Component, OnInit  } from '@angular/core';
  import * as signalR from '@aspnet/signalr';
  @Component({
    selector: 'app-chat',
    templateUrl: './chat.component.html',
    styleUrls: ['./chat.component.scss']
  })
  export class ChatComponent implements OnInit {
   
    msgRetrieved: string = '?'; 
    message: string = '';
  
  
    constructor() { 
    } 
  
    ngOnInit() { 
      this.hubConnection = new signalR.HubConnectionBuilder().withUrl(&quot;https://localhost:44338/chat&quot;).build();
      this.hubConnection.start()
        .then(() =&gt; { })
        .catch((err) =&gt; console.log(err))
  
      this.registerSignalEvents();
    }
    registerSignalEvents() {
      this.hubConnection.on('ReceiveMessage', this.ReceiveMessage);
    }
    ReceiveMessage(msg: string) {
      debugger
      this.msgRetrieved = msg; 
      console.log('ReceiveMessage' + this.msgRetrieved)
    }
    sendMessage() {
      this.hubConnection.invoke('SendMessage', this.message);
    }
    private hubConnection: signalR.HubConnection;
  
  }
  </code></pre>
  <p>as you can see in the &quot;ReceiveMessage&quot; method i try to set the &quot;msgRetrieved&quot; to the value of received message (  <code>this.msgRetrieved = msg;</code> ), in the debugger mode it is works fine, yet after the method, it turns back to &quot;?&quot; value which is the initial value.</p>
  <p>what am i missing here ?</p>