Skip to content

send() doesn't throw an error if client is disconnected #17

Open
@timwis

Description

@timwis

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions