Skip to content

Commit af779c5

Browse files
authored
revert: sse server close event as error
1 parent c669385 commit af779c5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/render/sse.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ func NewSSEStream(ctx context.Context, w http.ResponseWriter) (*SSEStream, error
8888

8989
func (s *SSEStream) loop() {
9090
defer func() {
91+
// This is kept for backward compatibility. We should remove this in the future.
92+
_ = s.send(SSEEvent{Type: "error", Data: SSEErrorData{Code: "SERVER_CLOSED"}})
93+
94+
// Notify the client that the stream is closed
9195
_ = s.send(SSEEvent{Type: "close", Data: "Stream closed by server"})
9296
close(s.stoppedCh)
9397
}()

0 commit comments

Comments
 (0)