WebSocket vs SSE vs polling
Pick the right real-time transport. Six questions — we will tell you when polling beats WebSockets and why you should not hold WebSockets open from serverless functions.
~~~
Recommended approach
Why
~~~
Comparison
| Protocol | Direction | Reconnection | Proxies | Serverless | Cost model |
|---|---|---|---|---|---|
~~~
Starter snippet
~~~
Don't use these here
~~~
About this tool
Real-time updates are not one-size-fits-all. WebSockets shine for bidirectional chat; Server-Sent Events cover one-way push with built-in reconnect; HTTP polling is boring but works on serverless and through strict proxies.
This chooser scores your answers and surfaces anti-recommendations — the mistakes that cause production incidents, like opening WebSockets from Cloudflare Workers without Durable Objects.
~~~
Read more
- An introduction to WebSockets
- How to use WebSockets with Node.js
- An introduction to HTTP — the foundation polling builds on
- Cloudflare Durable Objects— when you need WebSockets on the edge