mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 18:32:19 +00:00
Handle error
This commit is contained in:
parent
078a74add1
commit
f8aa587d0e
@ -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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user