Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: server-sent-event example should use c.Writer.CloseNotify() chan #169

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

justintoman
Copy link

I was basing an app off this example, and I was noticing that clients weren't getting closed until I tried (and failed) to send messages to disconnected clients.

Example: I'm connected to the SSE stream, then close the browser window. The log.Printf("Removed client") doesn't show up until after I try to send the next message to closed browser window.

Using c.Writer.CloseNotify() appears to work immediately.

@appleboy
Copy link
Member

@justintoman Please resolve the conflicts

@justintoman justintoman force-pushed the fix/server-sent-event-close-notify branch from 1e618be to bc9b555 Compare December 17, 2024 18:35
@justintoman
Copy link
Author

Conflicts resolved.

@0legmax -- The conflicts were with your PR to drain the clientChan. I believe I merged these correctly, but wanted to check with you to make sure I didn't mess up what you'd done.

@appleboy
Copy link
Member

image

Please resolve again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants