title: Socket.io inside express routes
body: <p>Is it possible to use socket.io inside an express route?</p>
  
  <p>I want it to look like this:</p>
  
  <p>Server</p>
  
  <p>app.js:</p>
  
  <pre><code>app.get('/cool_page/',users.cool_page);
  </code></pre>
  
  <p>users.cool_page:</p>
  
  <pre><code>if (5&gt;3){
   socket.emit('first_connection',"true statement");
  }
  </code></pre>
  
  <p>Client:</p>
  
  <pre><code>socket.on('first_connection',function(data){
   if (data === "true statement"){
    console.log("success");
   }
  </code></pre>
  
  <p>So far it hadn't been working. I tried to envelope the users.cool_page in io.sockets.on("conection",function(socket){code...}), but that didn't work. I also redefined some variables inside the users.cool_page; like</p>
  
  <pre><code>var express = require('express');
  var app = express();
  var server = require('http').createServer(app);
  var io = require('socket.io').listen(server);
  </code></pre>
  
  <p>but it still doesn't work: without really outputting any error. </p>
  
  <p>I appreciate any help. Thanks.</p>