Skip to content

make useEventSource use regular EventSource instead of reconnecting-eventsource #563

Description

@AdamFipke

So our useEventSource (the hook that allows us to subscribe to Server Sent Events) uses reconnecting-eventsource . This hook will have it keep retrying if the server returns 500 level errors. For our production setup, it would be unheard of for our system to provide 500-level errors for queue requests (other than when the system goes down for an extended period of time). Therefore, we can just cut the dependency by switching it out with regular EventSource.

Additionally, maybe it would be nice if we could stop the hook from trying to keep re-connecting onerror when on dev. This is because on dev if the connection fails, it likely means we just shut down the dev server on our local systems, so we wouldn't want our browsers constantly trying to send requests forever (drains my laptop battery). This behaviour should only exist for dev though since IRL people's connections to the internet may temporarily go out for a few seconds, so it makes sense to try to reconenct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions