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

How do I handle disconnecting consumers manually? #6

Closed
jpfuentes2 opened this issue Apr 1, 2013 · 2 comments
Closed

How do I handle disconnecting consumers manually? #6

jpfuentes2 opened this issue Apr 1, 2013 · 2 comments
Assignees

Comments

@jpfuentes2
Copy link

I'm not seeing a good mechanism here to disconnect a consumer manually.

My use-case is this: a client will make a POST /some-route which kicks off a back-end service and allows other clients to watch for SSE on GET /events and I'm simply forwarding all output from the back-end service to the clients via es.SendMessage. I would like to close the SSE connections on those clients when the back-end service is finished.

Do you have any ideas?
Thanks!

@ghost ghost assigned antage Apr 1, 2013
@antage
Copy link
Owner

antage commented Apr 2, 2013

"Hard" disconnecting should be used in exceptional cases (network error, killed process, etc).
I think in your use-case you can notify consumers (via SSE message) about the back-end service is stopping. So a consumer can disconnect itself.

@jpfuentes2
Copy link
Author

Thanks so much. That's what I have been doing, but it felt wrong for some reason. I do see that the W3 spec doesn't have much to say about server-side intentional disconnects. I'll keep using what I have been -- thanks!

On Tuesday, April 2, 2013 at 2:10 AM, Anton Ageev wrote:

"Hard" disconnecting should be used in exceptional cases (network error, killed process, etc).
I think in your use-case you can notify consumers (via SSE message) about the back-end service is stopping. So a consumer can disconnect itself.


Reply to this email directly or view it on GitHub (#6 (comment)).

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

No branches or pull requests

2 participants