This commit is contained in:
parent
e25d5e33a1
commit
014401aa90
2
main.go
2
main.go
@ -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"))
|
||||
|
Loading…
Reference in New Issue
Block a user