added logging
All checks were successful
Build and Push / build (push) Successful in 1m31s

This commit is contained in:
hook-lord 2024-09-14 07:06:34 +02:00
parent e25d5e33a1
commit 014401aa90

View File

@ -9,6 +9,7 @@ import (
var eventChan = make(chan string)
func SSEHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("Client connected from %s", r.RemoteAddr)
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Connection", "keep-alive")
@ -37,6 +38,7 @@ func SSEHandler(w http.ResponseWriter, r *http.Request) {
}
func TriggerHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("Confetti request received from: %s", r.RemoteAddr)
eventChan <- "Confetti Triggered!"
w.WriteHeader(http.StatusOK)
w.Write([]byte("Confetti Triggered"))