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