Skip to main content

Continuous polling vs. webhook subscriptions

Webhooks are a performant alternative to continuously polling for changes. Webhooks remove the need to send requests over and over. Instead, the service provider sends notifications whenever updated data it available.

What is polling

Polling is the process of repeatedly hitting the same endpoint looking for new data, which is wasteful and discouraged. In this case requesting for changes run at a fixed interval.

Request origin

Polling requests are made by the client, while webhook requests are made by the service provider. Webhooks are also automatically triggered when an event occurs, whereas polling is set up to run at fixed intervals and runs whether there is a new data or not.

Real-Time Updates

With polling, there will always be an interval between requests that creates a delay in receiving an update. Approximating real time feedback with polling would require a lot of resources and could incur high costs.

Webhooks are generated by the service provider that observes the triggering event so updates can happen as the events happen.

Efficiency

Polling can be resource-intensive as you need to make requests whether the efforts will be fruitful or not. This is not the case for webhook requests, which are only made when there is new information. That's a win for both the client and the service provider.

Zapier estimates that only 1.5% of polling requests find an update.

When to use polling

Generally speaking, you should only use polling if you meet two conditions:

  • You don't need updates in real time
  • Updates are very frequent

When both of these are true, polling is actually a very good solution because you won't have wasted API calls and sending webhooks for every event would be a waste of resources.

When to use webhooks

If you need updated data in real-time or updates are not very frequent, webhooks are the perfect solution.