How do I handle disconnecting consumers manually?
jpfuentes2 opened this issue · comments
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!
"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.
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)).