title: in node.js using socket.io, how to add to socket listener dynamically?
body: <p>if have standard <code>socket.io</code> setup:</p>
  
  <pre><code>var app = require('http').createServer().listen(80,'127.0.5.12'),
  io = require('socket.io').listen(app);
  
  session = require('./local_modules/session.js');
  
  // creating a new websocket to keep the content updated without any AJAX request
  io.sockets.on('connection', function(socket) {
  
    // session, login, logout
    socket.on( 'session', session.session.bind(socket) );
    socket.on( 'login', session.login.bind(socket) );
    socket.on( 'logout', session.logout.bind(socket) );
  
    // what to add new listener here!
  });
  </code></pre>
  
  <p>later in the program, once it knows what it wants to do, it wishes to add new functionality to the socket listener.  for example, in the middle of 'session' might wish to add 'something-new':</p>
  
  <pre><code>exports.session = function( sid) {
    var socket = this;
    ...
    // everything cool, now want to add 'something-now' to socket
    // do I simply - will something simple as this work?
    socket.on( 'something-new', session.something_new.bind(socket) );
  }
  
  exports.something_new = function( arg ) {
  }
  </code></pre>
  
  <p>is this correct - it just seems wrong?</p>