Active viewer PING controller. Closes #790 (#990)

This commit is contained in:
Gabe Kangas
2021-05-20 20:29:01 -07:00
committed by GitHub
parent be71685937
commit 91f6dcd0f6
11 changed files with 89 additions and 27 deletions

View File

@@ -9,7 +9,7 @@ import (
// GetConnectedClients returns currently connected clients.
func GetConnectedClients(w http.ResponseWriter, r *http.Request) {
clients := core.GetClients()
clients := core.GetChatClients()
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(clients); err != nil {

13
controllers/ping.go Normal file
View File

@@ -0,0 +1,13 @@
package controllers
import (
"net/http"
"github.com/owncast/owncast/core"
"github.com/owncast/owncast/utils"
)
func Ping(w http.ResponseWriter, r *http.Request) {
id := utils.GenerateClientIDFromRequest(r)
core.SetViewerIdActive(id)
}