2020-10-07 08:14:33 +02:00
|
|
|
package controllers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/owncast/owncast/core"
|
|
|
|
)
|
|
|
|
|
2020-11-13 00:14:59 +01:00
|
|
|
// GetConnectedClients returns currently connected clients.
|
2020-10-07 08:14:33 +02:00
|
|
|
func GetConnectedClients(w http.ResponseWriter, r *http.Request) {
|
|
|
|
clients := core.GetClients()
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
|
2020-11-15 03:39:53 +01:00
|
|
|
if err := json.NewEncoder(w).Encode(clients); err != nil {
|
|
|
|
internalErrorHandler(w, err)
|
|
|
|
}
|
2020-10-07 08:14:33 +02:00
|
|
|
}
|