Network 2026-06-27 ⏱ 4 min read

Comparing Real-Time Web Communication: Polling, SSE, WebSocket, WebRTC, and WebTransport

Five common real-time web communication technologies, Polling, SSE, WebSocket, WebRTC, and WebTransport, compared side by side. This article sorts them by direction and transport, lays out each one's overview, minimal implementation, and pros and cons, and gives selection criteria. A map for choosing a real-time method.

Read in: ja
Comparing Real-Time Web Communication: Polling, SSE, WebSocket, WebRTC, and WebTransport

Introduction

On the web, you often need to push data from server to client right away.

Chat, notifications, stock prices, multiplayer games, and video calls all demand real-time delivery.

This article compares five common real-time web communication technologies side by side.

For each, it lays out an overview, a minimal implementation, and pros and cons, then closes with selection criteria.

For a broader comparison of API styles, read Comparing API Styles. This article drills into the real-time slice.

Classification Axes

Before the comparison, here are the axes.

Polling

The client asks the server at a fixed interval and picks up updates. It ranks as the most basic approach.

Short polling repeats at a fixed interval; long polling holds the response open until an update arrives.

// short polling
setInterval(async () => {
  const res = await fetch("/api/messages");
  const data = await res.json();
  render(data);
}, 3000);

Pros / Cons

SSE (Server-Sent Events)

The server streams events to the client continuously over a single HTTP connection, one-way.

const es = new EventSource("/api/stream");
es.onmessage = (e) => render(JSON.parse(e.data));

Pros / Cons

WebSocket

Over a single connection, client and server exchange messages both ways.

It upgrades from HTTP and holds a persistent connection.

const ws = new WebSocket("wss://example.com/socket");
ws.onmessage = (e) => render(e.data);
ws.onopen = () => ws.send("hello");

Pros / Cons

WebRTC

WebRTC exchanges audio, video, and data peer-to-peer between browsers at low latency.

Establishing a connection needs out-of-band signaling (exchanging SDP and ICE candidates).

const pc = new RTCPeerConnection();
const channel = pc.createDataChannel("chat");
channel.onmessage = (e) => render(e.data);
// then exchange SDP and ICE candidates through a signaling server

Pros / Cons

WebTransport

WebTransport is a newer API that runs over HTTP/3 (QUIC), bidirectional and multiplexed.

People see it as a successor to WebSocket; it offers both reliable streams and unordered datagrams.

const wt = new WebTransport("https://example.com:4433/wt");
await wt.ready;
const stream = await wt.createBidirectionalStream();

Pros / Cons

A Cross-Cutting Comparison

Aspect Polling SSE WebSocket WebRTC WebTransport
Direction one-way (pull) one-way (push) bidirectional bidirectional (P2P) bidirectional
Transport HTTP HTTP TCP (HTTP upgrade) UDP (P2P) HTTP/3 (QUIC)
Browser support all wide wide wide limited
Reconnection manual automatic manual manual manual
Main use simple update checks notifications, feeds chat, games calls, video high-volume, low-latency
Complexity low low medium high medium-high

Selection Criteria

Here is guidance that maps needs to a technology.

When in doubt, start from SSE or WebSocket. If one-way suffices, SSE is easy; if you need two-way, WebSocket is easy.

Summary

Real-time web communication sorts by direction and transport.

Pick by need: Polling or SSE for simplicity, WebSocket for two-way, WebRTC for media, WebTransport for the cutting edge.

References

Tags: Polling SSE WebSocket WebRTC WebTransport Real-time
Share: 𝕏 Post Facebook Hatena
✏️ View source / Discuss on GitHub
☕ Support

If you enjoy this blog, consider supporting it. Every bit helps keep it running!


Related Articles