You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
I'm implementing a
broadcast
function by storing an array of theclient
s as they join, via theconnection
event. Thebroadcast
function then loops through the array andsend
s to each client. Since there's nodisconnect
event with SSEs, my thought was to wrap thesend
in atry/catch
block and, if it throws an error, remove theclient
from the array so they're not in there next time. Butsend()
doesn't seem to throw an error even if the client is long gone. So the list of clients potentially gets gigantic.Any suggestions?
The text was updated successfully, but these errors were encountered: