title: Separating socket IO calls for cleaner code in Node and Express
body: <p>So, I'm making an app and I have gotten socket IO working and the app just runs on Express.</p>
  <p>Anyway, within the main server file is where I am doing my calls.  Some examples:</p>
  <pre><code>//Object 1
  io.of('/type1').on
  (   'connection', socket =&gt; 
  {   socket.on
      (   'call1', () =&gt;
          {   doSomething1();
          }
      );
  }
  );
  
  // Object 2
  io.of('/type2').on
  (   'connection', socket =&gt; 
  {   socket.on
      (   'call2', () =&gt;
          {   doSomething2();
          }
      );
  }
  );
  </code></pre>
  <p>Obviously, there are way more socket.on calls for the various objects.  What I wanted to do was actually separate these objects' logic from the main loop into some separate files to better clean up the main server.js file I have.  I've got some 300 lines of various socket calls.</p>
  <p>Something like socketCalls1.js for Object 1, etc.</p>
  <p>The only thing is that the io variable doesn't seem sharable across multiple files...  Is there a good, clean way of doing this?</p>