Skip to content
BENIBIX Learn

Webhook vs Polling

With a webhook, the other service calls you as soon as something happens. With polling, you keep asking it if anything has changed. Webhooks are faster and use less, but your server must be open to the web.

Development🔌 APIs

Webhook

A web address for news. Another app calls it when an event takes place.

A webhook is a web address another service calls when something happens. That service sends a POST request to your address with the details. A payment service can tell your shop the moment a payment goes through. You no longer have to keep asking if anything has changed. Your server must answer fast and check that the message is real.

Example
Emma gives a payment service her webhook address. A customer pays, and seconds later her shop gets a POST that says paid.
Why it matters
Apps can act at once. They do not waste thousands of requests asking if anything is new.
Full entry
Development🌐 Web Development

Polling

The browser asks the server, is there news? It asks again and again.

Polling means the browser asks the server for news on a timer. Every few seconds it sends a request. The server answers with new data, or with nothing. It is simple and works in all browsers, but most requests come back empty. Long polling is a smarter version: the server holds each request open until it has news. Both are older ways to get live updates.

Example
Jack's first version checked for new orders every 10 seconds. With 1,000 shop owners online, that was 100 requests a second, mostly empty.
Why it matters
Polling is the easiest way to get updates. Sometimes it is all you need.
Full entry

In one line

Webhook
A web address for news. Another app calls it when an event takes place.
Polling
The browser asks the server, is there news? It asks again and again.