_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

WebSocket vs SSE vs Long Polling

10. 09. 2025 1 min read intermediate

Každá má své výhody a ideální use case.

WebSocket

Plně duplexní. Klient i server posílají kdykoliv.

const ws = new WebSocket(‘wss://api.example.com/ws’); ws.onmessage = (e) => console.log(e.data); ws.send(‘Hello’);

SSE

Jednosměrný stream server → klient přes HTTP. Jednodušší, auto-reconnect.

const es = new EventSource(‘/events’); es.onmessage = (e) => console.log(e.data);

Long Polling

Request → server drží dokud nemá data → odpověď → nový request.

Kdy co

  • WebSocket — chat, hry, collaboration (obousměrné)
  • SSE — notifikace, feed, dashboardy (jednosměrné)
  • Long Polling — fallback

WebSocket pro duplex, SSE pro stream

Long polling jen jako fallback.

websocketssereal-time
Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.