Webhooks are a simple way of sending data between servers. No long-lived connections are needed. The sender makes an HTTP request to the receiver when there is data to push.
How it works: Just make an HTTP request to a callback URL. It’s that easy! The request method is usually
POST. Some APIs require the callback URLs to be configured manually using a user interface. Others offer programmatic registration. See REST Hooks for some nice guidelines on how to add programmatic registration to a RESTful API. You may also consider PubSubHubbub if you are sending feed updates.
When to use it: Webhooks are great for pushing data to other servers. Also, if you’re not sure who will consume your realtime API, Webhooks are a good place to start because the barrier to entry is low. You can easily make HTTP requests directly from your server code, without setting up any new components or changing programming languages.
Caveats: Browsers and other client applications cannot receive Webhooks directly, so if you want a client application to support live updates then you’ll need to use one of the other mechanisms. Webhooks are also harder to test (compared to just running
wscat), but tools like ngrok, RequestBin and WebhookInbox can help with this.