owncast/controllers/admin/viewers.go

16 lines
375 B
Go
Raw Normal View History

package admin
import (
"encoding/json"
"net/http"
"github.com/gabek/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)
}