Polling
Also called: short polling, periodic refresh, checking for updates.
The page asks the server "anything new?" again and again on a timer, for example every 5 seconds. It is simple, but news arrives up to one interval late, and most requests come back empty.
The page asks the server “anything new?” every 2 s. A message waits on the server until the next check, and most checks find nothing.
Stopped
Say it in a prompt
While the order page is open and the tab is visible, poll GET /api/orders/:id/status every 5 seconds. Send the last ETag in If-None-Match so an unchanged status returns 304, and stop polling once the status is "delivered" or after 10 minutes. Seen on
- GitHub REST API: The events API is built for polling: it sends an X-Poll-Interval header with how many seconds to wait, and 304 Not Modified when nothing changed.
You might describe it as
- page that checks for new messages every few seconds
- keep asking the server if something changed
- auto refresh the data on a timer
Not to be confused with
- Server-sent events (SSE)
With polling the page keeps asking; with server-sent events the server tells the page the moment something happens.
- Webhook
Polling is your code asking again and again; a webhook is the other service calling your server once when something happens.