mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-22 19:42:20 +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) {
|
||||
// Display connected users stats
|
||||
enc := json.NewEncoder(w)
|
||||
enc.Encode(struct {
|
||||
err := enc.Encode(struct {
|
||||
ConnectedViewers int
|
||||
}{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