title: Socket.io emit to specific client in tabs
body: <p>I am using socket.io with angular. It works fine but my problem is that it emits to all the tabs opened in Chrome. The current workflow is the app will be opened in multiple tabs to run different simulation. When i press the button (action) it updates all the opened tabs. However, i want to emit to specific tab. How do i design that? I looked at stackoverflow and github but couldnt get the socket.id to work. </p>
  
  <p><strong>Server Code</strong></p>
  
  <pre><code>app.use(function(req, res, next) {
      var socketid = ''
      socketio.sockets.on('connection', function(socket) {
          socketid = socket.id
  
          res.socketid = socketid
              // 
      });
      res.socketio = socketio;
      next();
  });
  
      console.log('sockrt ' + res.socketid)
      res.socketio.emit('pyr', output) //res.socketid is undefined
  </code></pre>
  
  <p><strong>Updated</strong></p>
  
  <p>app.js</p>
  
  <pre><code>app.use(function(req, res, next) {
      var socketid = ''
      socketio.sockets.on('connection', function(socket) {
          socketid = socket.id
  
          res.socketid = socketid
              // 
      });
      res.socketio = socketio;
      next();
  });
  </code></pre>
  
  <p>py.controller.js (api endpoint)</p>
  
  <pre><code>export function index(req, res) {
          console.log('sockrt ' + res.socketid)
          res.socketio.emit('pyr', output)
  
      };
  </code></pre>
  
  <p>The endpoint is working and socket.io is working but the socket.id is undefined. I just need to figure out a way to isolate the connection to a browser tab.</p>