code: func newRPCServer(config *rpcserverConfig) (*rpcServer, error) {
  	rpc := rpcServer{
  		cfg:                    *config,
  		statusLines:            make(map[int]string),
  		gbtWorkState:           newGbtWorkState(config.TimeSource),
  		helpCacher:             newHelpCacher(),
  		requestProcessShutdown: make(chan struct{}),
  		quit: make(chan int),
  	}
  	if cfg.RPCUser != "" && cfg.RPCPass != "" {
  		login := cfg.RPCUser + ":" + cfg.RPCPass
  		auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
  		rpc.authsha = sha256.Sum256([]byte(auth))
  	}
  	if cfg.RPCLimitUser != "" && cfg.RPCLimitPass != "" {
  		login := cfg.RPCLimitUser + ":" + cfg.RPCLimitPass
  		auth := "Basic " + base64.StdEncoding.EncodeToString([]byte(login))
  		rpc.limitauthsha = sha256.Sum256([]byte(auth))
  	}
  	rpc.ntfnMgr = newWsNotificationManager(&rpc)
  	rpc.cfg.Chain.Subscribe(rpc.handleBlockchainNotification)
  
  	return &rpc, nil
  }
docs: // newRPCServer returns a new instance of the rpcServer struct.