code: func (s *Service) reportStats(conn *websocket.Conn) error {
  	// Gather the syncing and mining infos from the local miner instance
  	var (
  		mining   bool
  		hashrate int
  		syncing  bool
  		gasprice int
  	)
  	if s.eth != nil {
  		mining = s.eth.Miner().Mining()
  		hashrate = int(s.eth.Miner().HashRate())
  
  		sync := s.eth.Downloader().Progress()
  		syncing = s.eth.BlockChain().CurrentHeader().Number.Uint64() >= sync.HighestBlock
  
  		price, _ := s.eth.APIBackend.SuggestPrice(context.Background())
  		gasprice = int(price.Uint64())
  	} else {
  		sync := s.les.Downloader().Progress()
  		syncing = s.les.BlockChain().CurrentHeader().Number.Uint64() >= sync.HighestBlock
  	}
  	// Assemble the node stats and send it to the server
  	log.Trace("Sending node details to ethstats")
  
  	stats := map[string]interface{}{
  		"id": s.node,
  		"stats": &nodeStats{
  			Active:   true,
  			Mining:   mining,
  			Hashrate: hashrate,
  			Peers:    s.server.PeerCount(),
  			GasPrice: gasprice,
  			Syncing:  syncing,
  			Uptime:   100,
  		},
  	}
  	report := map[string][]interface{}{
  		"emit": {"stats", stats},
  	}
  	return websocket.JSON.Send(conn, report)
  }
docs: // reportPending retrieves various stats about the node at the networking and
  // mining layer and reports it to the stats server.