Fix: sse changes
This commit is contained in:
11
main.go
11
main.go
@ -11,10 +11,11 @@ import (
|
||||
func ListenToRequests(port string) error {
|
||||
mux := http.NewServeMux()
|
||||
server := &http.Server{
|
||||
Handler: handlers.LogRequests(handlers.GetSession(mux)),
|
||||
Addr: port,
|
||||
ReadTimeout: time.Second * 5,
|
||||
WriteTimeout: time.Second * 5,
|
||||
Handler: handlers.LogRequests(handlers.GetSession(mux)),
|
||||
Addr: port,
|
||||
ReadTimeout: time.Second * 5,
|
||||
// WriteTimeout: time.Second * 5,
|
||||
WriteTimeout: 0, // sse streaming
|
||||
}
|
||||
fs := http.FileServer(http.Dir("assets/"))
|
||||
mux.Handle("GET /assets/", http.StripPrefix("/assets/", fs))
|
||||
@ -34,6 +35,8 @@ func ListenToRequests(port string) error {
|
||||
mux.HandleFunc("GET /room/hideform", handlers.HandleHideCreateForm)
|
||||
mux.HandleFunc("GET /word/show-color", handlers.HandleShowColor)
|
||||
mux.HandleFunc("POST /check/name", handlers.HandleNameCheck)
|
||||
// sse
|
||||
mux.Handle("GET /sub/sse", handlers.Notifier)
|
||||
slog.Info("Listening", "addr", port)
|
||||
return server.ListenAndServe()
|
||||
}
|
||||
|
Reference in New Issue
Block a user