Skip to content

Commit f7ccc7c

Browse files
authored
fix(sse): update error handling for closed streams
1 parent ce4644d commit f7ccc7c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/render/sse.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ type SSEErrCode string
1515

1616
const (
1717
InternalServiceErr SSEErrCode = "INTERNAL_SERVER_ERROR"
18-
ServerCloseErr SSEErrCode = "SERVER_CLOSED"
1918
)
2019

2120
type SSEErrorData struct {
@@ -89,7 +88,7 @@ func NewSSEStream(ctx context.Context, w http.ResponseWriter) (*SSEStream, error
8988

9089
func (s *SSEStream) loop() {
9190
defer func() {
92-
_ = s.send(SSEEvent{Type: "error", Data: SSEErrorData{Code: ServerCloseErr}})
91+
_ = s.send(SSEEvent{Type: "close", Data: "Stream closed by server"})
9392
close(s.stoppedCh)
9493
}()
9594

0 commit comments

Comments
 (0)