code: function(id, socket) {
    EventEmitter.call(this);
    this.id = id;
    this.socket = socket;
    this.remoteAddress = {
      ip: socket.handshake.address.address,
      port: socket.handshake.address.port
    };
  
    var self = this;
  
    socket.on('disconnect', this.emit.bind(this, 'disconnect'));
  
    socket.on('error', this.emit.bind(this, 'error'));
  
    socket.on('message', function(msg) {
      self.emit('message', msg);
    });
  
    this.state = ST_INITED;
  
    // TODO: any other events?
  }
docs: Socket class that wraps socket.io socket to provide unified interface for up level.