mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2025-06-27 13:42:05 +02:00
Handle error
This commit is contained in:
@ -88,7 +88,11 @@ func staticHandler() http.Handler {
|
|||||||
func statisticsHandler(w http.ResponseWriter, r *http.Request) {
|
func statisticsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
// Display connected users stats
|
// Display connected users stats
|
||||||
enc := json.NewEncoder(w)
|
enc := json.NewEncoder(w)
|
||||||
enc.Encode(struct {
|
err := enc.Encode(struct {
|
||||||
ConnectedViewers int
|
ConnectedViewers int
|
||||||
}{webrtc.GetNumberConnectedSessions()})
|
}{webrtc.GetNumberConnectedSessions()})
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, "Failed to generate JSON.", http.StatusInternalServerError)
|
||||||
|
log.Printf("Failed to generate JSON: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user