title: Setting state variables on the client side in SignalR
body: <p>I'm using the javascript library to connect to a signalR server being hosted in a console app.</p>
  
  <p>Therefore I connect and set client methods which can be called from the server like so:</p>
  
  <pre><code>var connection = $.hubConnection('http://localhost:8080'),
      proxy = connection.createHubProxy('TestApp');
  
  proxy.on('sendMessage', function () {
      // do stuff!
  });
  </code></pre>
  
  <p>which is described in detail <a href="https://github.com/SignalR/SignalR/wiki/SignalR-JS-Client-Hubs-%28No-Proxy%29" rel="nofollow">here</a>.</p>
  
  <p>However, the documentation for using the client side javascript in this manner doesn't explain how to round-trip information (set the 'state' variable on the client side and have it accessible from the server).</p>
  
  <p>It's probably pretty obvious, but any help will be much appreciated!</p>
  
  <p>Also, there is something which I think is closely related that I'm curious about. I know the client side code can get a return value/callback after calling a function on the server like so (from the documentation linked above)</p>
  
  <pre><code>proxy.invoke('add', 1, 2)
       .done(function(result) {
           console.log('The result is ' + result);
       });
  </code></pre>
  
  <p>but is it possible for the server to get a callback from the client when the client finished a task? (Obviously just having a the client trigger a predefined event solves this problem, but it would be nice to handle all callback without having to setup another event if this is possible.)</p>
  
  <p>Thanks!!</p>