Realtime Data in JS / Page 5

Where Each One Actually Fits

The same “chat” demo makes the APIs comparable. This page moves back to the real strengths: chat for WebSocket, notifications for SSE, webcam streaming for WebRTC, and live telemetry for WebTransport.

WebSocket → rooms SSE → notifications WebRTC → media WebTransport → telemetry

WebSocket

Room chat

Full duplex

The classic server-centered room: simple, responsive, and easy to reason about.

Server-Sent Events

Notifications

One-way push

The server owns the feed. The client just stays subscribed and renders each alert.

WebRTC

Webcam streaming

Peer media

The server only signals. Video tracks flow peer to peer once the connection is up.

Media Idle
Peers 0 live
Local

WebTransport

Live telemetry

Datagrams

Only the latest cursor position matters here, so lossy datagrams are a good fit.

Session Checking
Peers 0 remote