From b0e3cdc07708cf0c0c153f7733a197a2ca8f4896 Mon Sep 17 00:00:00 2001 From: linhujun Date: Tue, 15 Apr 2025 11:18:39 +0800 Subject: [PATCH] fix(context): improve client disconnection handling in Stream method --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index 1c76c0f6..fefd2a27 100644 --- a/context.go +++ b/context.go @@ -1208,7 +1208,7 @@ func (c *Context) SSEvent(name string, message any) { // indicates "Is client disconnected in middle of stream" func (c *Context) Stream(step func(w io.Writer) bool) bool { w := c.Writer - clientGone := w.CloseNotify() + clientGone := c.Request.Context().Done() for { select { case <-clientGone: