owncast/controllers/admin/viewers.go
leowmjw 769fc3a561
Fixes #211: Update mod paths (#221)
Co-authored-by: Michael Leow <mleow@moneylion.com>
2020-10-05 10:07:09 -07:00

16 lines
377 B
Go

package admin
import (
"encoding/json"
"net/http"
"github.com/owncast/owncast/metrics"
)
// GetViewersOverTime will return the number of viewers at points in time
func GetViewersOverTime(w http.ResponseWriter, r *http.Request) {
viewersOverTime := metrics.Metrics.Viewers
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(viewersOverTime)
}