2020-10-02 09:06:14 +02:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/http"
|
|
|
|
|
2020-10-05 19:07:09 +02:00
|
|
|
"github.com/owncast/owncast/metrics"
|
2020-10-02 09:06:14 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
}
|