fix(sse): disable read deadline for long-lived connections #56
Reference in New Issue
Block a user
Delete Branch "fix-sse-read-deadline"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The server's
ReadTimeout(15s) was closing SSE connections shortly after they were established, causing a rapid connect/disconnect loop:The handler already disabled
WriteTimeoutviaSetWriteDeadline(time.Time{})but did not disableReadTimeout. Once the read deadline fired, Go's HTTP server closed the underlying connection.Fix: Also call
rc.SetReadDeadline(time.Time{})to keep the connection alive indefinitely.