title: (React/redux) Using Sockets with redux to only send changed pieces of state
body: <p>I'm trying to figure out how to use socket.io alongside of my react/redux application, and seeing how much I can optimize when doing so. So, on the server I have a pretty basic setup with the sockets you can see here : </p>
  
  <pre><code>store.subscribe(() =&gt; {
      io.emit('state', store.getState().toJS());
  });
  
  io.on('connection', (socket) =&gt; {
      socket.emit('state', store.getState().toJS());
      socket.on('action', function (action) {
          action.headers = socket.request.headers;
          store.dispatch(action);
      });
  });
  </code></pre>
  
  <p>So the only thing out of the ordinary is I was just sticking the request headers onto the actions for use later. What I would like to try and achieve is something like this -</p>
  
  <pre><code> io.connections[i].emit('state')
  </code></pre>
  
  <p>and add</p>
  
  <pre><code>socket.on('state', (action) =&gt; {
      socket.emit('state', getUserSpecificState(store));
  });
  </code></pre>
  
  <p>The idea is this would allow me to loop through all the connections, and then use that connection's socket to call for the specific user at the time. I don't know if something like this is possible, and am looking for some possible feedback in handling sending back only user specific information back. It would also be cool to only send back the part of the state changed by the action (and not the whole state), and then have the front end store assemble the state. Any/all input is more than welcomed, thanks!</p>