title: SignalR client is reconnected after Owin restart, but message is not published
body: <p><strong>Setup:</strong></p>
  
  <blockquote>
    <ol>
    <li>SignalRServer console app: Microsoft.AspNet.SignalR.SelfHost v2.0.3 </li>
    <li>SignalRClient console app: Microsoft.AspNet.SignalR.Client v2.0.3</li>
    <li>.NET 4.5.1</li>
    </ol>
  </blockquote>
  
  <p>I do the following:</p>
  
  <blockquote>
    <ol>
    <li>Hit enter on client, a message is received at server and on client again</li>
    <li>Dispose the server by hitting any key in the server console</li>
    <li>Restart the server by hitting any key in the server console</li>
    <li>Client is reconnected</li>
    <li>Hit enter on client, message is received at server, but never reaches the client again</li>
    </ol>
  </blockquote>
  
  <p>I expect the message to be received at the client again. I suspect it has something to do with the self-hosting, since I've tried to run the client against same hub in a web application running IIS with success.</p>
  
  <p>Any ideas?</p>
  
  <p><strong>Update:</strong> if the server console process is killed and restarted, it is able to reconnect AND retrieve messages again.</p>
  
  <p><strong>Server code</strong>
  </p>
  
  <pre><code>using System;
  using System.Threading.Tasks;
  using Microsoft.AspNet.SignalR;
  using Microsoft.Owin.Hosting;
  using Owin;
  
  namespace SignalRServer
  {
      internal class Program
      {
          private static void Main(string[] args)
          {
              const string url = "http://localhost:8081";
  
              while (true)
              {
                  using (WebApp.Start&lt;Startup&gt;(url))
                  {
                      Console.WriteLine("Server running on {0}. Hit any key to stop.", url);
                      Console.ReadLine();
                  }
  
                  Console.WriteLine("Server stopped");
  
                  Console.WriteLine("Hit any key to restart, Esc to exit");
  
                  ConsoleKeyInfo ki = Console.ReadKey(true);
  
                  if (ki.Key == ConsoleKey.Escape)
                      return;
              }
          }
      }
  
      public class Startup
      {
          public void Configuration(IAppBuilder app)
          {
              app.MapSignalR();
          }
      }
  
      public class AuthenticationHub : Hub
      {
          public void BroadcastMessageToAll(string message)
          {
              Clients.All.sendMessageToClient(message);
              Console.WriteLine("sendMessageToClient: " + message);
          }
  
          public override Task OnConnected()
          {
              Console.WriteLine("OnConnected " + Context.ConnectionId);
              return base.OnConnected();
          }
  
          public override Task OnReconnected()
          {
              Console.WriteLine("OnReconnected " + Context.ConnectionId);
              return base.OnReconnected();
          }
  
          public override Task OnDisconnected()
          {
              Console.WriteLine("OnDisconnected " + Context.ConnectionId);
              return base.OnReconnected();
          }
      }
  }
  </code></pre>
  
  <p><strong>Client code</strong>
  </p>
  
  <pre><code>using System;
  using Microsoft.AspNet.SignalR.Client;
  
  namespace SignalRClient
  {
      class Program
      {
          static void Main(string[] args)
          {
              while (true)
              {
                  var hubConnection = new HubConnection("http://localhost:8081/signalr/hubs");
  
                  hubConnection.Closed += () =&gt; Console.WriteLine("Closed");
                  hubConnection.StateChanged += e =&gt; Console.WriteLine("StateChanged: " + e.OldState + " " + e.NewState);
                  var hubProxy = hubConnection.CreateHubProxy("AuthenticationHub");
  
                  hubProxy.On&lt;string&gt;("sendMessageToClient",
                      info =&gt; Console.WriteLine("sendMessageToClient received: " + info));
                  hubConnection.Start();
  
                  Console.WriteLine("Client started - hit Enter to send a message - ESC to stop");
  
                  Console.ReadKey();
  
                  while (true)
                  {
                      var keyInfo = Console.ReadKey(true);
  
                      if (keyInfo.Key == ConsoleKey.Escape)
                          break;
  
                      var message = "Console client : " + DateTime.Now.ToString("HH:mm:ss-fff");
                      hubProxy.Invoke("BroadcastMessageToAll", message);
                      Console.WriteLine("Client sent BroadcastMessageToAll: " + message);
                  }
  
                  Console.WriteLine("Client stopping");
  
                  hubConnection.Stop();
  
                  Console.WriteLine("Client stopped - enter any key start again");
                  Console.ReadLine();
              }
          }
      }
  }
  </code></pre>