marcospds / ngx-sse-client

An SSE (server sent event) client alternative solution for Angular
MIT License
22 stars 3 forks source link

Multiple concurrent streams #12

Closed benthieu closed 4 months ago

benthieu commented 6 months ago

Multiple concurrent streams don't work because of the private chunk property. The property is overwritten by a second subscription. This property should be unique for each stream and not be shared IMO Is there a workaround for this?

marcospds commented 4 months ago

Hi @benthieu, could you send me a code example?

benthieu commented 4 months ago

Hello @marcospds

I created this repository to showcase the issue: https://github.com/benthieu/ngx-sse-showcase

You can launch the server with: npx nx run nest-sse-mock:serve --configuration=development. This will serve two SSE-stream endpoints.

To launch the frontend use: npx nx run ngx-sse-showcase:serve --configuration=development.

Two concurrent streams do not work on my device. The first/second stream always waits for the other stream to finish. Is this an issue on my side? I see that the request is being opened but the answer from the Observable is not returned.

marcospds commented 4 months ago

Hello, the problem was fixed in version 17.0.1.

benthieu commented 3 months ago

Just tested it 👍🏻

Great work, thanks a lot @marcospds