Polling vs Long-Poll vs SSE Playground

Rara’s order news comes three ways: setInterval (bikes back and forth), long-poll, or an EventSource (the gudang’s phone line). How many requests go out, how…

Why it matters

Notifications, order status, changing prices, build logs: many pages need news from the server without asking. Polling is easy but wasteful and late; long-polling is quick but opens a new request for every piece of news; SSE (EventSource) uses one HTTP response that never closes, reconnects by itself, and is enough for one-way news. For fully two-way, then WebSocket.

The key idea

Who starts it: the page asking, or the gudang writing

Common mistakes

Try it in this playground