code: function() {
    EventEmitter.call(this);
    this.httpServer = new HttpServer();
  
    var self = this;
    this.wsServer = new WebSocketServer({server: this.httpServer});
  
    this.wsServer.on('connection', function(socket) {
      // emit socket to outside
      self.emit('connection', socket);
    });
  
    this.state = ST_STARTED;
  }
docs: websocket protocol processor