Hacker News new | ask | show | jobs
by arxpoetica 3494 days ago
Honest question. Why webhooks over something like push/pull handshaked socket?
2 comments

For the receiver: Everything that can run a dynamic website can run a webhook receiver, opening an arbitrary socket connection isn't possible in all environments (e.g. software running on shared hosting or PaaS). You'd also need to define and implement a protocol on top of said socket, whereas more or less every web developer knows what to do with HTTP POST with a JSON payload.

And for the sender, keeping many concurrent connections open can be quite a challenge. Sending Webhooks also takes resources, but at least you can easily distribute it over many machines/processes if necessary.

Slack offers both. Their realtime API is especially nice because you connect to it rather than needing to deploy public facing web services to receive events from them.

On the other hand, if you are not connected, messages could be lost unless you build in syncing capability, whereas with web hooks, Slack will handle the retries for you.