Live streams and webhooks
Polling, SSE and WebSockets
Choose a connection model for the required flow.
Understand the concept
Polling requests periodically, trading simplicity for empty responses or delay. Long polling holds a request until an event or timeout. SSE streams server-to-client events through text/event-stream.
WebSockets support bidirectional messaging, not a universally better solution. After the handshake, framing differs from ordinary HTTP exchanges. Plan proxy timeouts, heartbeats, reconnect and backpressure.
SSE IDs can support resuming with a defined replay store. EventSource credentials/header capabilities differ from Fetch. Authenticate, authorise and limit long-lived connections, with bounded reconnection behaviour.
Build notifications, job progress and live status.
Assuming WebSockets automatically solve reconnect and ordering.
One topic. Three levels of depth.
Polling: GET /jobs/123 every bounded intervalChoose a bounded interval deliberately.
This page does not send requests to external servers. Messages are readable HTTP/1.1 illustrations, not HTTP/2 or HTTP/3 wire dumps. example.test is reserved for examples. Run commands and JavaScript only in your own test environment; never publish real tokens or cookies.
Try it yourself first.
Is WebSocket necessary for one-way job progress?
Show the solution and explanation
One-way events → consider SSENo; SSE may suit the flow, depending on infrastructure.