DEV Community

Cover image for Realtime data streaming using server-sent events(SSE) with react.js and node.js

Realtime data streaming using server-sent events(SSE) with react.js and node.js

Peter Kelvin Torver on March 12, 2022

We live in a world where real-time data streaming has become paramount. Real-time data streaming has become a necessity in modern applications beca...
Collapse
 
caschbre profile image
Craig Aschbrenner

Great article!

A couple of questions regarding SSEs...

Have you come across issues with the maximum number of connections (using http/1) as noted here? Or do you ensure http/2 is used?

Have you come across any limitations on the server for keeping connections open? I haven't been able to find much information on how many connections a server can keep open. I realize that's based on server hardware, number of instances, number of concurrent users, etc... but I've been trying to find a baseline number to compare.

Collapse
 
techfortified profile image
Peter Kelvin Torver

Thank you very much for asking this question. The max number(6) of connections indicated over there is per browser per domain. For instance with Google Chrome you can open 6 max number of connections to example.com and with ms edge you can still open another max connection of 6 to the same domain.
To answer your question;

  1. The number of connections a server can handle is limitless and depending on the capacity of your hardware just like you stated.
  2. What's indicated above is not possible in real life application because you can't just create 6 accounts on applications like twitter and login in this browser.
  3. Using HTTP/1 is the one with such limit but using HTTP/2 should increase it upto 100 max connections per browser per domain.
  4. The max number of connections indicated above is per browser per domain and not what your server can handle.

If you find anything worth sharing, please don't forget to share it with us. Thank you

Collapse
 
ana1vergara profile image
Ana Maria Vergara Posada

Hello,
The number of connections that the server support also depends on what web server you are using, for example, if you are using Apache, this formula gives you the number according to the hardware of your server:

(Total Memory – Critical Services Memory) / Size Per Apache process

It gives you the limit recommended for the Apache configuration, so your server will be optimized.

Collapse
 
tonystrawberry profile image
Tony Duong

Thank you! 😊

Collapse
 
waseyhasankhan profile image
waseyhasankhan

👍

Collapse
 
the-arcade-01 profile image
arcade

Great post with clear and easy explanation 👌

Collapse
 
techfortified profile image
Peter Kelvin Torver

My pleasure

Collapse
 
codexpath2 profile image
Emmanuel Jacob

keep up man. great content

Collapse
 
techfortified profile image
Peter Kelvin Torver

My pleasure

Collapse
 
janpauldahlke profile image
jan paul

awesome article. I Just yesterday coded somehing very similar by chance, since my boss need to display streamed data in "real-time-charts".

Collapse
 
techfortified profile image
Peter Kelvin Torver

Wow that's great. Which tech stacks did u use?

Collapse
 
jreegene profile image
Jeremiah

Great article

Collapse
 
techfortified profile image
Peter Kelvin Torver

Thank you, Jeremiah

Collapse
 
copenju profile image
copenju

The Reveal Music was here ,thanks for this tutorial man keep up the good work

Collapse
 
techfortified profile image
Peter Kelvin Torver

You are welcome. Glad you found it helpful

Collapse
 
doroszenko profile image
Andrzej

Thanks!

Collapse
 
techfortified profile image
Peter Kelvin Torver

Welcome

Collapse
 
bastoker profile image
Bas 강남스타일 럭스

I think npmjs.com/package/@microsoft/fetch... deserves a mention here as well :-)

Collapse
 
bastoker profile image
Bas 강남스타일 럭스

I think npmjs.com/package/@microsoft/fetch... deserves a mention here as well