All posts
AWS Architecture

WebSockets Are Easy to Open and Hard to Run: How to Decide if Your Feature Needs One

By

November 2, 2026

7 min read

A WebSocket demo takes an afternoon. Keeping thousands of connections correct through deploys, reconnects, phones changing networks and a second server takes ongoing work. Many "realtime" features are better served by a 15-second poll or a server-sent event stream. A feature-by-feature guide, and the list of what you take on when the answer really is WebSockets.

WebSockets
Realtime
Architecture Decisions
Server-Sent Events

Every platform now makes the first WebSocket easy: Vercel Functions since October 2026, API Gateway and AppSync on AWS, Cloudflare, and every container host. That makes the decision more important, not less. The socket is the cheap part. The expensive part is everything that has to stay correct while thousands of them come and go.

Three options, in order of what they cost to run

Polling

Server-sent events (SSE)

WebSockets

Direction

Client asks

Server to client

Both ways

Protocol

Ordinary HTTP

Ordinary HTTP, a long response

An upgraded connection

Reconnects

Nothing to reconnect

The browser reconnects on its own, and can send the last event ID it saw

You write it, including catch-up

Caching, CDNs, proxies, corporate networks

Work as usual

Mostly work

Sometimes blocked or cut off

Server state per user

None

An open response

An open connection, plus whatever you track for it

Latency

Up to the interval

Immediate

Immediate, both ways

Feature by feature

Feature

Usually right

Why

Streaming an AI response

SSE

One-way, and it ends when the answer does. This is what most AI SDKs already use.

Notifications and badges

Polling every 15 to 60 seconds, or SSE

Nobody notices a 30-second delay; everyone notices a dropped socket that never reconnects

Dashboards and status pages

Polling

Cacheable, simple, and the data rarely changes faster than people read it

Job progress (an upload, an import, a report)

SSE or polling

One-way and short-lived

Chat and comments

WebSockets with a durable message store, or a managed service

Both directions, and history must survive reconnects

Presence and typing indicators

WebSockets or a managed service

Frequent, small, both ways; stale data is fine to drop

Collaborative editing

A managed service or a CRDT library on WebSockets

Conflict resolution is the real problem, and it is solved software

Multiplayer games, live auctions

WebSockets

Latency and ordering both matter

Not sure which row you're in?

Tell us what you're building and we'll tell you what we'd use and roughly what it costs to run. Free, 30 minutes, whether or not you hire us.

What you take on with WebSockets

  • Reconnects with backoff and jitter, so a deploy or a blip doesn't bring every client back in the same second.

  • Catch-up: messages sent while a client was disconnected need sequence numbers and a store to replay from.

  • Fan-out across servers: a message arriving on one instance has to reach sockets held by the others, which means Redis, a managed pub/sub, or a service built for it.

  • Authorization over time: a connection opened at 9am may outlive the session, role or account that opened it.

  • Deploys: old connections keep running old code until they close, or you close them and absorb the reconnect storm.

  • Phones: networks change, apps are suspended, and a socket that looks open often isn't. Heartbeats and timeouts are yours.

  • Ordering and duplicates: at-least-once delivery means handlers must be idempotent.

  • Observability: request logs don't show a connection that's been open for 20 minutes. You need connection counts, message rates and reconnect rates.

  • Load testing: the failure is rarely steady state. It is 10,000 clients reconnecting at once after a deploy.

When to buy instead

Managed realtime services (Ably, Pusher, Liveblocks, Firebase, and AWS AppSync Events) handle reconnection, fan-out, presence and often history as features. They charge per message or connection, which looks expensive next to a socket you host until you price the engineering time for the list above. For collaborative editing in particular, buying is usually right.

Already running WebSockets and they're a headache?

We look at what you run, where it breaks and what it costs, and tell you whether to fix it, simplify it or hand part of it to a managed service.

hoolco Monthly Review

Once a month: what changed in tech that month and what it means for you, from cloud and AI to security and the tools you build with. Every item links to its source. No sales pitch, unsubscribe in one click.

As of November 2, 2026. Provided as is, for general information, and accurate to the best of our knowledge on the date shown. Not legal, compliance, tax, financial or other professional advice. Prices, limits and vendor services change; check current vendor documentation before relying on anything here. Terms of use.