title: SignalR sometimes not calling the client methods
body: <p>I have a SignalR hub where it is pushing some number increments (and decrements) to Javascript clients in a webpage. ASP.NET MVC page pulls the initial value from the database initially, and then SignalR kicks in. The methods are generally invoked, but some get lost in the way. For example:</p>
  
  <ul>
  <li>The initial value of <code>x</code> is, say, 100000.</li>
  <li>Server increments generally about 100 times in a minute.</li>
  <li>The value of <code>x</code> is incremented at the client about 50-60 times, so say <code>x</code> becomes 100055.</li>
  <li>When I refresh the page, <code>x</code> is pulled from the database, and it's actual value of 100100.</li>
  </ul>
  
  <p>The hub code is extremely simple, and I'm logging when data comes from the server:</p>
  
  <pre><code>$(function () {
      var connection = $.connection.adminhub;
      var myToken = "@ViewBag.Code";
  
      connection.client.increment = function (data) {
          console.log("SignalR: increment " + data);
          var num = parseInt($("#" + data).text());
          $("#" + data).text(num + 1);
      };
  
      connection.client.decrement = function (data) {
          console.log("SignalR: decrement " + data);
          var num = parseInt($("#" + data).text());
          $("#" + data).text(num - 1);
      };
      console.log("Connecting to SignalR...");
      $.connection.hub.start().done(function () {
          console.log("Connected to SignalR.");
          connection.server.registerForIndex(myToken);
      });
  
  });
  </code></pre>
  
  <p><code>ViewBag.Code</code> is a special token written by the server, it works (otherwise it can't receive any data). There is only one place on the server which calls the hub's method:</p>
  
  <pre><code>    static IHubContext Instance{
          get
          {
              return GlobalHost.ConnectionManager.GetHubContext&lt;AdminHub&gt;();
          }
      }
  
      public static void Increment(string key)
      {
          Instance.Clients.Group("stats").increment(key);
      }
  </code></pre>
  
  <p>My client(s) is/are registered in the <code>stats</code> group. I've tried with different browsers and different OS's, they act all the same. I've checked the lifetime events and there are no connection slowdowns, disconnects, reconnects. I am connected using websockets transport, and my connection to both the Internet and the server is quite stable. Why are my values off by about 50% and how can I correct this behavior?</p>