Remove keepalive
This commit is contained in:
14
lib/sse.go
14
lib/sse.go
@ -6,7 +6,6 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"atri.dad/lib/pubsub"
|
||||
"github.com/labstack/echo/v4"
|
||||
@ -90,19 +89,6 @@ func SetSSEHeaders(c echo.Context) {
|
||||
c.Response().Header().Set(echo.HeaderCacheControl, "no-cache")
|
||||
}
|
||||
|
||||
func CreateTickerAndKeepAlive(c echo.Context, duration time.Duration) *time.Ticker {
|
||||
ticker := time.NewTicker(duration)
|
||||
go func() {
|
||||
for range ticker.C {
|
||||
if _, err := c.Response().Write([]byte(": keep-alive\n\n")); err != nil {
|
||||
log.Printf("Failed to write keep-alive: %v", err)
|
||||
}
|
||||
c.Response().Flush()
|
||||
}
|
||||
}()
|
||||
return ticker
|
||||
}
|
||||
|
||||
func HandleIncomingMessages(c echo.Context, pubsub pubsub.PubSubMessage, client chan string) {
|
||||
for {
|
||||
select {
|
||||
|
Reference in New Issue
Block a user