title: How to emit server-side error and receive details about the error client-side, using Socket.IO?
body: <p>Using socket.io, what is the prescribed method of emitting an error so that error information is sent to the client?</p>
  
  <p>I have this: </p>
  
  <pre><code>socket.on('connection', function(socket) { 
    if (someError) {
      emit('error', 'there is a error...');
    }
  };
  </code></pre>
  
  <p>I know that there is a way to do something like what I want by registering a middleware with socket.io, but I'm not sure what I would need to do from the middleware to transmit the error information back down to the client:</p>
  
  <pre><code>io.use(function(socket, next) {
    next(new Error('An error has occurred.'));
  });
  </code></pre>
  
  <p>Thanks in advance for any constructive guidance.</p>