title: SignalR 2.0 .NET console client
body: <p>I have my server console app:</p>
  
  <pre><code>    static void Main(string[] args)
      {
          string url = "http://localhost:8080";
          using (WebApp.Start(url))
          {
              MyHub hub = new MyHub();
              Console.WriteLine("Server running on {0}", url);
              var key = Console.ReadLine();
              while (key != "quit")
              {
                  hub.Send("Server", key);
              }
          }
      }
  
  public class MyHub : Hub
  {
      public void Send(string name, string message)
      {
          var context = GlobalHost.ConnectionManager.GetHubContext&lt;MyHub&gt;();
          context.Clients.All.addMessage(name, message);
      }
  }
  public class Startup
  {
      public void Configuration(IAppBuilder app)
      {
          app.UseCors(CorsOptions.AllowAll);
          app.MapSignalR();
      }
  }
  </code></pre>
  
  <p>And my .NET client app</p>
  
  <pre><code>    static void Main(string[] args)
      {
  
          MainAsync().Wait();
          Console.ReadLine();
      }
  
      static async Task MainAsync()
      {
          try
          {
  
              var hubConnection = new HubConnection("http://localhost:8080/");
              //hubConnection.TraceLevel = TraceLevels.All;
              //hubConnection.TraceWriter = Console.Out;
              IHubProxy hubProxy = hubConnection.CreateHubProxy("MyHub");
              hubProxy.On("addMessage", data =&gt;
                  {
                      Console.WriteLine("Incoming data: {0} {1}", data.name, data.message);
                  });
              ServicePointManager.DefaultConnectionLimit = 10;
              await hubConnection.Start();
  
          }
          catch (Exception ex)
          {
  
          }
      }
  </code></pre>
  
  <p>I do not get any error when running the client. However, nothing gets printed out on the console. </p>
  
  <p>When I uncomment these 2 lines:</p>
  
  <pre><code>hubConnection.TraceLevel = TraceLevels.All;
  hubConnection.TraceWriter = Console.Out;
  </code></pre>
  
  <p>I am able to see some trace outputs in the console</p>
  
  <pre><code>07:56:28.0121460 - 355ca933-de49-400b-b859-c9dde6361151 - WS: OnMessage({"C":"d-
  69A14839-B,0|C,0|D,1|E,0","S":1,"M":[]})
  07:56:28.0277722 - 355ca933-de49-400b-b859-c9dde6361151 - ChangeState(Connecting
  , Connected)
  07:56:33.4655493 - 355ca933-de49-400b-b859-c9dde6361151 - WS: OnMessage({"C":"d-
  69A14839-B,1|C,0|D,1|E,0","M":[{"H":"MyHub","M":"addMessage","A":["Server","Hello World"]}]}
  )
  07:56:37.9657773 - 355ca933-de49-400b-b859-c9dde6361151 - WS: OnMessage({})
   07:56:47.9975354 - 355ca933-de49-400b-b859-c9dde6361151 - WS: OnMessage({})
  </code></pre>
  
  <p>"Server" and "Hello World" are the messages that are being sent from the server, so I guess the client is receiving the messages, just that I'm probably printing them out to the console the wrong way</p>
  
  <p>Can anyone help?</p>
  
  <p>Additional Info: I am able to receive the messages fine on my MVC application. </p>