For one-way server-to-client updates, SSE is the lighter option: it runs over plain HTTP, each client holds one long-lived connection, and the browser reconnects automatically if it drops. On a 2GB / 1 vCPU box the real limit is how many idle connections your stack can keep open, not SSE vs WebSocket itself - nginx in front of a small Node or Go process holds thousands of idle SSE connections fine. WebSockets only earn their overhead when you need two-way traffic or binary data. For notifications or a live feed, start with SSE and measure before reaching for anything heavier.
It is always possible to create aliases for your domain (for example: 1.mydomain.com, 2.mydomain.com, etc.) and access them using a "round-robin" logic, thereby overcoming the browser-imposed limit of six simultaneous connections per domain. SSE do not pose a genuine limitation.
It is possible to create "wildcard" certificates for *.api.mydomain.com. The web server can be configured very easily using aliases. By creating 50 aliases, you will achieve 300 simultaneous connections; well above the required number. The process takes only 15 minutes, and there is no need to restart the server. This is a quick and simple solution, certainly faster than modifying the connection protocol and re-testing all the behaviors of the Layer 3 and 4 stacks.
One gotcha worth knowing if browsers are the clients: over HTTP/1.1 Chrome only allows 6 connections per domain, and each SSE stream eats one, so a user with a few tabs open can lock themselves out. Serve it over HTTP/2 and that limit goes away. On a 2gb box the bottleneck will be memory per connection in your runtime much more than the protocol itself.
it's still a long-lived connection, so the per-box limits are similar. the difference is what happens when that box goes away. an SSE client just reconnects with a Last-Event-ID header and any instance behind the load balancer can pick it up, as long as events come from a shared pub/sub (redis or whatever) instead of memory on one node. websocket apps usually keep per-connection state on the server, so you end up needing sticky sessions or a resume protocol you write yourself
For one-way server-to-client streaming, Server-Sent Events over HTTP/2 is lighter and easier to maintain than WebSockets.
Under HTTP/2, SSE shares your existing TCP and TLS connection alongside standard page requests. WebSockets require a separate TCP handshake and protocol upgrade, holding a dedicated socket open for the lifetime of the session.
SSE also handles connection drops natively in the browser:
Automatic reconnection through the retry directive.
State resumption using the Last-Event-ID header.
Clean pass-through on corporate proxies and load balancers because it remains standard HTTP (text/event-stream).
WebSockets only make sense over SSE if you need high-frequency bidirectional messaging, or if your backend is stuck on HTTP/1.1 where browsers cap concurrent connections at 6 per domain. If all you need is push notifications, metrics, or LLM token streaming, HTTP/2 SSE is the cleaner architecture.
One caveat: Last-Event-ID is just a cursor. EventSource reconnects, but replaying missed events still requires the server to retain them and serve events after that ID.
True, and if the server uses a short TTL ring buffer in Redis or drops events after a restart, clients still need a stale-cursor fallback to pull a full snapshot. EventSource mostly just saves you writing the reconnect loop yourself.
For one-way, SSE, but not because it is meaningfully lighter per connection. On a 2 GB / 1 vCPU box, both are long-lived TCP connections, and your ceiling will be the same things either way: memory per connection in your runtime, the open file descriptor limit, and what you do per message.
Things that actually decide it:
File descriptors first. The default ulimit -n is often 1024, which caps you long before RAM does. Raise it for the service user, whichever protocol you pick.
Per-connection memory depends on the server, not the protocol. An idle socket in Node or Go is a few KB. If your framework allocates buffers or a session object per connection, that dominates.
SSE is plain HTTP, so it goes through proxies, CDNs and load balancers without upgrade handling, and you get automatic reconnect with Last-Event-ID for free. With WebSockets you write reconnect and resume yourself.
The one SSE gotcha: over HTTP/1.1, browsers allow about 6 connections per domain, so a user with several tabs open can starve themselves. Serve it over HTTP/2 and that goes away.
Disable proxy buffering for the SSE route (nginx: proxy_buffering off), or events arrive in clumps and look broken.
Rough expectation: an idle-heavy workload on that box can hold tens of thousands of connections with either protocol once the fd limit is raised. If you broadcast often, CPU becomes the limit before connection count does.
If you ever need client to server messages, a normal POST next to SSE covers most cases before you need WebSockets.
SSE for one-way, agreed with everyone here, but the part that bites people in production is the proxy config, not the protocol. Nginx buffers responses by default, which silently breaks streaming, and its default read timeout kills idle connections after about 60 seconds. So turn buffering off for the SSE route (X-Accel-Buffering: no, or proxy_buffering off) and send a heartbeat comment every 20 to 30 seconds so the connection stays visibly alive.
The other free win with SSE: the browser's EventSource reconnects on its own and sends Last-Event-ID, so your resume logic costs nothing. With websockets you hand-roll reconnects plus ping/pong keepalive, and you still get to explain sticky sessions to whoever owns the load balancer.
for strictly one-way server-to-client streaming, sse will comfortably handle more concurrent connections on a 2gb box, mostly because sse over http/2 multiplexes multiple streams over a single tcp socket while standard websockets demand a dedicated tcp connection and socket buffer (rmem/wmem) per client. the memory bottleneck on a 1 vcpu / 2gb vps isn't cpu cycles, it's kernel socket memory and reverse proxy buffering; with sse you just need to make sure your reverse proxy has buffering turned off (like X-Accel-Buffering: no on nginx) so it streams chunks immediately instead of holding tcp buffers in memory. you also get browser reconnection and message replay out of the box with native EventSource via Last-Event-ID, whereas running thousands of idle websockets forces you to maintain your own ping/pong heartbeat timers on the event loop to purge dead sockets imo
for one way id go SSE, its plain http so proxies and reconnects mostly just work out of the box. websockets only pay off once the client needs to talk back too
For strictly one way communication, I would start with SSE.
WebSockets are useful when the application needs continuous two way communication, but using them for a server to client only stream can introduce complexity you may not need.
That said, with only 2 GB RAM and 1 vCPU, I would pay particular attention to how the server handles concurrent connections. The runtime, memory per connection, heartbeat frequency and event frequency can have a bigger impact than the protocol choice itself.
I would benchmark both with the same number of clients and payload frequency, then compare memory usage, CPU and latency. That should give you a much clearer answer for your actual workload.
For one-way updates they're about equally efficient. Both are one long-lived connection per client, and capacity depends more on your runtime than on the protocol.
I'd pick SSE: plain HTTP, built-in auto-reconnect, simpler to run. Use HTTP/2 to avoid the browser's ~6 connections per domain limit.
On a 2 GB VPS the real limits are file descriptors (raise ulimit -n), memory per connection, and message rate. If you're behind nginx, set proxy_buffering off for SSE, or events get held back.
SSE fits one-way updates, but it doesn't automatically mean more concurrent clients on that VPS. Test with the message size and frequency you expect, including clients on slow connections. If outgoing messages keep piling up in memory, 2 GB can disappear long before you hit the connection count you measured with idle clients.
efficient is vague, but if you wanted to move to binary streaming. SSE is mostly text. A more raw form is HTTP ReadableStream, but you have to define what is a message. Although. I think the bigger constraints will be your 2GB memory and the data you are wanting to send. That will bottleneck first.
For one-way updates from the server to the browser, I’d go with SSE. It runs on normal HTTP, so proxies and load balancers just work, and the browser reconnects on its own if the connection drops. WebSockets can do more, but you only need that when the client has to send data back often. On a small VPS with 1 vCPU and 2 GB RAM, both can hold a lot of open connections, probably somewhere between 10,000 and 50,000 idle ones if you use an event-based server like Node, Go or Nginx. The real limit usually isn’t the connection count, it’s how often you send messages, since that’s what eats the single CPU. Also remember to raise your file descriptor limit, and use HTTP/2 with SSE so you don’t run into the 6 connections per domain limit in browsers. I’d test it with a tool like k6 to see where your own server starts to struggle.
10
u/Afnan_CH_Digital 16d ago
For one-way server-to-client updates, SSE is the lighter option: it runs over plain HTTP, each client holds one long-lived connection, and the browser reconnects automatically if it drops. On a 2GB / 1 vCPU box the real limit is how many idle connections your stack can keep open, not SSE vs WebSocket itself - nginx in front of a small Node or Go process holds thousands of idle SSE connections fine. WebSockets only earn their overhead when you need two-way traffic or binary data. For notifications or a live feed, start with SSE and measure before reaching for anything heavier.
71
u/clearlight2025 16d ago
SSE for one way events, web sockets for duplex communications
35
u/kyle787 16d ago
SSE for one way. Web sockets make deployment and scaling a pain in the ass.
13
u/UnderstandingSure732 16d ago
Build SSE first, it’s cheaper. Then change to websockets if needed.
7
u/Turbulent_Ad9831 16d ago
For one-way server-to-client streaming, Server-Sent Events over HTTP/2 is lighter and easier to maintain than WebSockets.
Under HTTP/2, SSE shares your existing TCP and TLS connection alongside standard page requests. WebSockets require a separate TCP handshake and protocol upgrade, holding a dedicated socket open for the lifetime of the session.
SSE also handles connection drops natively in the browser:
retrydirective.Last-Event-IDheader.text/event-stream).WebSockets only make sense over SSE if you need high-frequency bidirectional messaging, or if your backend is stuck on HTTP/1.1 where browsers cap concurrent connections at 6 per domain. If all you need is push notifications, metrics, or LLM token streaming, HTTP/2 SSE is the cleaner architecture.
3
u/bkocdur 15d ago
For one-way, SSE, but not because it is meaningfully lighter per connection. On a 2 GB / 1 vCPU box, both are long-lived TCP connections, and your ceiling will be the same things either way: memory per connection in your runtime, the open file descriptor limit, and what you do per message.
Things that actually decide it:
ulimit -nis often 1024, which caps you long before RAM does. Raise it for the service user, whichever protocol you pick.Last-Event-IDfor free. With WebSockets you write reconnect and resume yourself.proxy_buffering off), or events arrive in clumps and look broken.Rough expectation: an idle-heavy workload on that box can hold tens of thousands of connections with either protocol once the fd limit is raised. If you broadcast often, CPU becomes the limit before connection count does.
If you ever need client to server messages, a normal POST next to SSE covers most cases before you need WebSockets.
2
u/adilbasari 16d ago
SSE for one-way, agreed with everyone here, but the part that bites people in production is the proxy config, not the protocol. Nginx buffers responses by default, which silently breaks streaming, and its default read timeout kills idle connections after about 60 seconds. So turn buffering off for the SSE route (X-Accel-Buffering: no, or proxy_buffering off) and send a heartbeat comment every 20 to 30 seconds so the connection stays visibly alive.
The other free win with SSE: the browser's EventSource reconnects on its own and sends Last-Event-ID, so your resume logic costs nothing. With websockets you hand-roll reconnects plus ping/pong keepalive, and you still get to explain sticky sessions to whoever owns the load balancer.
3
u/nameupp 16d ago
for strictly one-way server-to-client streaming, sse will comfortably handle more concurrent connections on a 2gb box, mostly because sse over http/2 multiplexes multiple streams over a single tcp socket while standard websockets demand a dedicated tcp connection and socket buffer (rmem/wmem) per client. the memory bottleneck on a 1 vcpu / 2gb vps isn't cpu cycles, it's kernel socket memory and reverse proxy buffering; with sse you just need to make sure your reverse proxy has buffering turned off (like X-Accel-Buffering: no on nginx) so it streams chunks immediately instead of holding tcp buffers in memory. you also get browser reconnection and message replay out of the box with native EventSource via Last-Event-ID, whereas running thousands of idle websockets forces you to maintain your own ping/pong heartbeat timers on the event loop to purge dead sockets imo
1
u/Alternative_Nose_874 15d ago
for one way id go SSE, its plain http so proxies and reconnects mostly just work out of the box. websockets only pay off once the client needs to talk back too
1
u/maheshwhartech 15d ago
For strictly one way communication, I would start with SSE.
WebSockets are useful when the application needs continuous two way communication, but using them for a server to client only stream can introduce complexity you may not need.
That said, with only 2 GB RAM and 1 vCPU, I would pay particular attention to how the server handles concurrent connections. The runtime, memory per connection, heartbeat frequency and event frequency can have a bigger impact than the protocol choice itself.
I would benchmark both with the same number of clients and payload frequency, then compare memory usage, CPU and latency. That should give you a much clearer answer for your actual workload.
1
u/DEMORALIZ3D front-end 15d ago
depends which way, SSE usually.
1
u/crazedizzled 15d ago
Websockets are meant for bi-directional, constant communication. You definitely want SSE.
1
u/lucky555_me 15d ago
For one-way updates they're about equally efficient. Both are one long-lived connection per client, and capacity depends more on your runtime than on the protocol.
I'd pick SSE: plain HTTP, built-in auto-reconnect, simpler to run. Use HTTP/2 to avoid the browser's ~6 connections per domain limit.
On a 2 GB VPS the real limits are file descriptors (raise ulimit -n), memory per connection, and message rate. If you're behind nginx, set proxy_buffering off for SSE, or events get held back.
1
u/J_Galang 15d ago
Depends. Usually safer to start with SSE since web sockets can be a pain to maintain. Switch when you need to.
1
u/Hostman_com 14d ago
SSE fits one-way updates, but it doesn't automatically mean more concurrent clients on that VPS. Test with the message size and frequency you expect, including clients on slow connections. If outgoing messages keep piling up in memory, 2 GB can disappear long before you hit the connection count you measured with idle clients.
1
u/scottix 12d ago
efficient is vague, but if you wanted to move to binary streaming. SSE is mostly text. A more raw form is HTTP ReadableStream, but you have to define what is a message.
Although.
I think the bigger constraints will be your 2GB memory and the data you are wanting to send. That will bottleneck first.
1
u/Kirat-batth0217 15d ago
For one-way updates from the server to the browser, I’d go with SSE. It runs on normal HTTP, so proxies and load balancers just work, and the browser reconnects on its own if the connection drops. WebSockets can do more, but you only need that when the client has to send data back often. On a small VPS with 1 vCPU and 2 GB RAM, both can hold a lot of open connections, probably somewhere between 10,000 and 50,000 idle ones if you use an event-based server like Node, Go or Nginx. The real limit usually isn’t the connection count, it’s how often you send messages, since that’s what eats the single CPU. Also remember to raise your file descriptor limit, and use HTTP/2 with SSE so you don’t run into the 6 connections per domain limit in browsers. I’d test it with a tool like k6 to see where your own server starts to struggle.
-10
u/eltron 16d ago
Ask an LLM yo. This question is too generic.
0
u/blondhairdontcare55 15d ago
1 vcpu cause it’s good one way events