When the browser restarts, it will install a new EventSource on your server, right? Your problem is with an old one that no longer has a client endpoint.
I suggest you try to find out that this is the same connection with the client, and then explicitly call it completed for the old emitter.
In my case, I can detect this based on the token that EventSource passes as a URL parameter. When I connect the newly created emitter to the "user object", I must complete the previous emitter before assigning a new user field variable.
From your code, it looks like you have a list or set of emitters. Can you possibly create a card instead of it, where you have the customer ID as the key and the emitter as the value?
I canβt say exactly what part of the information to use as a client identifier, since it all depends on your application. In my case, this is a JWT token, but you could just create a client numbering scheme ...
source share