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

send() doesn't throw an error if disconnected #1

Open
timwis opened this issue Aug 9, 2016 · 1 comment
Open

send() doesn't throw an error if disconnected #1

timwis opened this issue Aug 9, 2016 · 1 comment

Comments

@timwis
Copy link

timwis commented Aug 9, 2016

I'm implementing a broadcast function by storing an array of the clients as they join, via the connection event. The broadcast function then loops through the array and sends to each client. Since there's no disconnect event with SSEs, my thought was to wrap the send in a try/catch block and, if it throws an error, remove the client from the array so they're not in there next time. But send() doesn't seem to throw an error even if the client is long gone. So the list of clients potentially gets gigantic.

Any suggestions?

(going to cross-post upstream too)

@coreybutler
Copy link
Member

@timwis Sorry for the delay... just saw this. As you've already pointed out, this really should be an upstream fix. Honestly, my approach was to hack around this... I use NGN data models with TTL to expire a connection after a given period of time. Far from ideal.

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