dunglas / mercure

🪽 An open, easy, fast, reliable and battery-efficient solution for real-time communications
https://mercure.rocks
GNU Affero General Public License v3.0
3.98k stars 297 forks source link

Increase EventSource connection limits over 100 in HTTP/2 #950

Closed Loocos closed 1 month ago

Loocos commented 2 months ago

Hello,

I know that HTTP/1 limit to 6 concurrents connection for EventSource. This is not my case, I'm using the HTTP/2 as I can open 50+ connections.

My problem is that I still have a limit of 100 (because after lot of opened connection, EventSource stuck on pending) like it is said on : https://developer.mozilla.org/en-US/docs/Web/API/EventSource I'm facing this limit when users open multiple tabs.

When using HTTP/2, the maximum number of simultaneous HTTP streams is negotiated between the server and the client (defaults to 100).

So my question is : How can we configure the server to increase this limit ? I havn't found anything to be able to do that.

If you've any best practice to provide in order to avoid this limit, will be really appreciated!

Thanks in advance for your help :)

Loocos commented 1 month ago

If this can help further, I want to increase the number of simultaneous streams connection by using Caddy on Platform.sh / Symfony Cloud.

dunglas commented 1 month ago

Hi,

I don't think that a JavaScript API exposes a way to set the limit. It is negotiated automatically by the browser (HTTP/2 and 3 clients may directly set the limit however).

That being said, it's weird that you need so much connections. Couldn't use multiple topic parameter or topic selectors to subscribe to many topics in a single HTTP connection? It's considered a best practice for Mercure even with HTTP/2+.

Loocos commented 1 month ago

Hi!

Alright, I didn't see that multiple topics was allowed. My bad..

Thanks for the confirmation & reminder, appreciated!