title: return client socket.io to variable
body: <p>On the docs page they say that i need to use like this.</p>
  
  <pre><code>io.on('connection', function (socket) {
      socket.emit('news', { hello: 'world' });
      socket.on('my other event', function (data) {
          console.log(data);
      });
  });
  </code></pre>
  
  <p>there is any way to expose the client to a variable?</p>
  
  <pre><code>var socket = io.on('connection');
  socket.emit('news', { hello: 'world' });
  </code></pre>
  
  <p>On the help page they say that <code>Server#onconnection(socket:engine#Socket):Server</code> expose a client, but i can't figure out how to use it. <a href="http://socket.io/docs/server-api/#server#onconnection(socket:engine#socket):server" rel="nofollow noreferrer">doc</a></p>
  
  <p>this way i can use socket inside my other functions.</p>
  
  <p>Right now on every function that i emiting stuff i do the <code>io.on('connection', function (socket)</code> all over again</p>
  
  <p>Another question:</p>
  
  <p>There is a way to different files emit event to each other</p>
  
  <p>app.js</p>
  
  <pre><code>var app = require('express')();
  var server = require('http').Server(app);
  var io = require('socket.io')(server);
  </code></pre>
  
  <p>file1.html emit</p>
  
  <pre><code>&lt;script src="socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      var socket = io('http://localhost');
  
      socket.emit('event15', function(x){
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>file2.html receive</p>
  
  <pre><code>&lt;script src="socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      var socket = io('http://localhost');
  
      socket.on('event15', function(x){
      });
  
  &lt;/script&gt;
  </code></pre>