code: function validateConfig(config) {
    var result = {}
  
    if (config.httpServer == null) throw Error("httpServer config property is null")
    result.httpServer = config.httpServer
  
    result.onRequest = config.onRequest || default_onRequest
    if (!_.isFunction(result.onRequest)) throw Error("onRequest config property is not a function")
  
    result.verbose = !!config.verbose
  
    return result
  
    //-----------------------------------
    function default_onRequest(request) {
      if (-1 == request.requestedProtocols.indexOf(exports.wsProtocol)) {
        return request.reject()
      }
  
      request.accept(exports.wsProtocol, request.origin)
    }
  }
docs: ------------------------------------------------------------------------------