title: Cannot send data if the connection is not in the 'Connected' State
body: <p>Doing a really simple call to setup  connect/stop using SignalR in Angular 6 where I had the following code:</p>
  
  <p><strong>signalR.helper.ts</strong></p>
  
  <pre><code>  public static setupHub&lt;T&gt;(hubUrl: string, eventName: string, callback: (data: T) =&gt; void, ...params: SignalRParam[]): HubConnection {
      const token = localStorage.getItem(appConstant.token);
      const url = this.buidlUrl(hubUrl, ...params);
      const connection = new HubConnectionBuilder()
          .withUrl(url,
              { transport: HttpTransportType.WebSockets, accessTokenFactory: () =&gt; token })
          .build();
      environment.production &amp;&amp; connection.start();
      !environment.production &amp;&amp; connection.start().catch(err =&gt; console.error(err.toString()));
      connection.on(eventName, callback);
      return connection;
  }
  </code></pre>
  
  <p>If I try to login on my page,I keep getting this error on console:</p>
  
  <blockquote>
    <p>signalR.helper.ts:19 Error: Cannot send data if the connection is not in the 'Connected' State.</p>
  </blockquote>
  
  <p>I'm new to SignalR and Angular and why I keep getting this error ?</p>