title: how to emit.to a socket.io room from within express route
body: <p>I have the following code structure:</p>
  
  <p><strong>/app.js</strong></p>
  
  <pre><code>var user = require('./server/routes/api/user');
  var io = require('socket.io').listen(server);
  require('./server/sockets/base')(io);
  </code></pre>
  
  <p>I know I can emit events the following way (tested and works)</p>
  
  <pre><code>io.to("someroom").emit("news", "news");
  </code></pre>
  
  <p>Problem is, I want to be able to emit the event from my route file, which doesn't have access to the io object.</p>
  
  <p><strong>/routes/api/user.js</strong></p>
  
  <pre><code>router.post('/login', function(req, res){
   // HERE I WANT TO EMIT THE EVENT BY USING io.to("someroom").emit("news", "news");
   // I TRIED req.socket.emit('news', { hello: 'world' }); without luck
  }
  </code></pre>
  
  <p>What would be the easiest way to emit with this folder structure?</p>