ping.go 350 B

123456789101112131415
  1. package controllers
  2. import (
  3. "net/http"
  4. "github.com/owncast/owncast/core"
  5. "github.com/owncast/owncast/models"
  6. )
  7. // Ping is fired by a client to show they are still an active viewer.
  8. func Ping(w http.ResponseWriter, r *http.Request) {
  9. viewer := models.GenerateViewerFromRequest(r)
  10. core.SetViewerActive(&viewer)
  11. w.WriteHeader(http.StatusOK)
  12. }