diff --git a/examples/web/sse_ex/exgom/sse.gom.go b/examples/web/sse_ex/exgom/sse.gom.go index 2783fe7..ee86580 100644 --- a/examples/web/sse_ex/exgom/sse.gom.go +++ b/examples/web/sse_ex/exgom/sse.gom.go @@ -39,7 +39,7 @@ func Page() g.Node { ), ), P( - g.Text("The new elements uses the sse.Connect attribute to connect to a server-side event streaming countdown."), + g.Text("The new elements uses the sse.Connect attribute to connect to a server-sent event streaming countdown."), ), Pre( Code( diff --git a/examples/web/sse_ex/extempl/sse.templ b/examples/web/sse_ex/extempl/sse.templ index dd4d2a5..7a63fde 100644 --- a/examples/web/sse_ex/extempl/sse.templ +++ b/examples/web/sse_ex/extempl/sse.templ @@ -32,7 +32,7 @@ templ Page() {

- The new elements uses the sse.Connect attribute to connect to a server-side event streaming countdown. + The new elements uses the sse.Connect attribute to connect to a server-sent event streaming countdown.

 			
diff --git a/examples/web/sse_ex/extempl/sse_templ.go b/examples/web/sse_ex/extempl/sse_templ.go
index 246abc5..b934f14 100644
--- a/examples/web/sse_ex/extempl/sse_templ.go
+++ b/examples/web/sse_ex/extempl/sse_templ.go
@@ -59,7 +59,7 @@ func Page() templ.Component {
 			if templ_7745c5c3_Err != nil {
 				return templ_7745c5c3_Err
 			}
-			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

The new elements uses the sse.Connect attribute to connect to a server-side event streaming countdown.

")
+			_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

The new elements uses the sse.Connect attribute to connect to a server-sent event streaming countdown.

")
 			if templ_7745c5c3_Err != nil {
 				return templ_7745c5c3_Err
 			}
diff --git a/examples/web/sse_ex/sse_ex.go b/examples/web/sse_ex/sse_ex.go
index 222f0e9..cf4c9fe 100644
--- a/examples/web/sse_ex/sse_ex.go
+++ b/examples/web/sse_ex/sse_ex.go
@@ -2,6 +2,7 @@ package sse_ex
 
 import (
 	"fmt"
+	"log/slog"
 	"net/http"
 	"strconv"
 	"time"
@@ -46,9 +47,16 @@ func (ex *example) countdown(w http.ResponseWriter, r *http.Request) {
 }
 
 func (ex *example) feed(w http.ResponseWriter, r *http.Request) {
-	rc := http.NewResponseController(w)
 	ctx := r.Context()
 
+	flusher, ok := w.(http.Flusher)
+	if !ok {
+		slog.Error("flush not supported")
+		w.WriteHeader(http.StatusInternalServerError)
+		w.Write([]byte("flush not supported"))
+		return
+	}
+
 	w.Header().Set("Content-Type", "text/event-stream")
 	w.Header().Set("Cache-Control", "no-cache")
 	w.Header().Set("Connection", "keep-alive")
@@ -62,7 +70,7 @@ func (ex *example) feed(w http.ResponseWriter, r *http.Request) {
 				_ = extempl.Message(countMessage).Render(ctx, w)
 			}
 		})
-		_ = rc.Flush()
+		flusher.Flush()
 		time.Sleep(time.Second)
 	}
 
@@ -73,7 +81,7 @@ func (ex *example) feed(w http.ResponseWriter, r *http.Request) {
 			_ = extempl.Message("Blastoff!").Render(ctx, w)
 		}
 	})
-	_ = rc.Flush()
+	flusher.Flush()
 	time.Sleep(2 * time.Second)
 
 	ex.sendEvent(w, shared.ResetEvent, func() {