use-event-source has a feature to deduplicate SSE connections in order to lower the number of EventStreams a browser needs to hold. However, when event name is the only differences, it creates multiple identical EventStreams and then on client side it listens to different events.
Instead, we can create a single EventStream for the same URL and withCredentials flag, no matter what event is.
use-event-source
has a feature to deduplicate SSE connections in order to lower the number ofEventStream
s a browser needs to hold. However, when event name is the only differences, it creates multiple identicalEventStream
s and then on client side it listens to different events.Instead, we can create a single
EventStream
for the same URL and withCredentials flag, no matter what event is.Example
Given code like these
It creates identical event streams
after