Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path →
REST vs webhooks vs SSE: who initiates, who stays open?
These get compared as if picking one replaces the others, but they answer different questions: who initiates the exchange, and does the connection persist. Most systems that feel "real-time" are quietly running all three at once.
The one distinction that decides everything
REST is client-initiated, pull-based request/response — the client always asks. Webhooks flip that relationship: the SERVER pushes an event by making an HTTP request to a URL the client registered in advance, which means the "client" must itself run a public server to receive it. SSE (Server-Sent Events) keeps the normal client-initiates-a-connection shape, but leaves that one connection open so the server can push a continuous stream of events over it.
Client always asks, no persistent state → REST. Server needs to notify another SERVER of an event → webhooks. Server needs to push a live stream to an open BROWSER tab → SSE.
Head to head
| Dimension | REST | Webhooks | SSE |
|---|---|---|---|
| Direction | Client pulls | Server pushes to client’s endpoint | Server pushes over an open connection |
| Connection | Short-lived, per request | Short-lived, one POST per event | One persistent, long-lived connection |
| Who exposes a public endpoint | The server (as usual) | The client must expose one | Only the server; client just connects out |
| Real-time-ness | Only as fresh as the poll interval | Near-instant, event-driven | Continuous, live |
| Delivery guarantees | N/A — one request, one response | No built-in order/retry — you build it | Ordered; built-in reconnect via Last-Event-ID |
| Browser support | Universal (fetch) | N/A — not a browser concept | Native EventSource, one-directional only |
| Best for | Standard CRUD, on-demand data | Server-to-server event notification | Live UI updates pushed to a browser |
| Infra needed | None extra | Endpoint + retry/idempotency/verification | Server holds one open connection per client |
When to use each
Reach for REST
- Standard CRUD APIs where the client always initiates
- On-demand reads, no ongoing state needed
- Universally supported, simplest to build and debug
Reach for webhooks or SSE
- Webhooks: server-to-server "tell me when X happens" (payments, CI/CD, third-party SaaS events)
- SSE: pushing live updates to an open browser tab (notifications, live scores, streaming tokens)
- Need bidirectional, not just server-push? That’s WebSockets — the fourth sibling, not covered here
Real systems run all three at once
A payment provider is a clean example: you use REST to create a charge (POST /charges), the provider uses a webhook to notify YOUR server the moment that charge settles or fails (server-to-server, asynchronous, could be minutes later), and your server then relays that status update to the customer's open browser tab over SSE so the UI updates live without a manual refresh. None of the three replaces another here — each is doing the specific job it fits.
REST for on-demand client actions. Webhooks for async server-to-server notification. SSE for pushing that notification the last mile, live, into an open UI.
The real axis: who exposes an endpoint, and does it stay open
The distinction that actually explains all three isn't simply "push vs pull" — it's two separate questions: WHO exposes a listening endpoint, and WHETHER the connection between them persists. Webhooks flip the usual client/server relationship entirely: the "client" in this exchange has to run its own public HTTP server to receive the callback, which is why webhook integrations need signature verification (proving the request really came from the sender) and idempotency handling (the sender may retry and send the same event twice) — problems that don't exist for REST, where the caller already trusts its own request. SSE keeps the normal relationship (client connects out to server) but leaves that one connection open indefinitely, which is a different kind of engineering cost: the server now has to hold open one connection per active client, rather than briefly touching a connection pool per request the way REST does.
This is also exactly why picking the wrong one breaks specific things: building "real-time notifications" with REST polling wastes resources checking at a fixed interval regardless of whether anything changed, and gives you staleness up to that interval by design. Trying to use SSE for guaranteed server-to-server delivery (payment or order events) loses out because SSE has no acknowledgment or retry semantics built for that relationship — it's built for pushing to an open UI, not for a durable notification contract between two backends, which is precisely the job webhooks (plus your own retry logic) are built for.
Webhooks trade REST's simple trust model for asynchronous push, at the cost of needing your own verification and retry logic. SSE trades REST's stateless simplicity for a live connection, at the cost of holding that connection open per client.
A worked scenario: a SaaS billing integration
A customer subscribes through your app: a REST call, POST /subscriptions, standard client-initiated request/response — nothing needs to stay open for this. Days later, a payment attached to that subscription fails; your billing provider needs to tell YOUR backend this happened, asynchronously, whenever it occurs — that's a webhook, which means your backend must expose an endpoint, verify the request's signature came from the real provider, and handle the possibility of the same event arriving twice.
Once your backend knows the payment failed, the customer — who happens to have their billing settings tab open right now — should see that status update live, without refreshing. That's SSE: your backend, having received the webhook, pushes the update down the customer's already-open connection. Three different problems (create a subscription, receive an async event from another company's server, push a live update to an open tab), three different tools, none of them interchangeable with either of the others for this job.
Ask, for each piece of the flow: does the client initiate, or does the server? And does anything need to stay open? The answer picks the tool — REST, webhook, or SSE — every time.
The flip point: wasted polls per real update
Polling asks “anything new?” on a fixed interval; a push (webhook or SSE) sends exactly one message per real update. If you need freshness of P seconds (poll every P) but updates actually arrive every U seconds, you make U/P polls per update and U/P − 1 of them return nothing.
Need 5-second freshness (P=5) on data that changes every 60 seconds (U=60) and you poll 60/5 = 12 times per update — 11 wasted calls for every one that matters. A push delivers exactly 1 message. The flip point: when the update interval is longer than the freshness you need (U/P > 1), push wins, and the rarer the updates relative to your freshness target, the more lopsided it gets. When updates are near-constant (U ≈ P), polling’s simplicity and statelessness are fine — you were going to fetch every interval anyway.
The picture: one billing flow, three wires
Cost and trade-offs: freshness against what the server holds
Here Time is how stale the client can be, and Space is what the server must keep. Time is what the user feels; Space is what your operations team carries. The illustrative fleet is 10,000 open tabs, with the page’s numbers: 5-second freshness on data that changes every 60 seconds.
| Case | Time | Space | Why |
|---|---|---|---|
| REST polling every 5 s | Up to 5 s stale, 2.5 s on average | Nothing between requests | 10,000 ÷ 5 = 2,000 requests/s, and 11 of every 12 (91.7%) come back empty. |
| REST polling every 60 s | Up to 60 s stale | Nothing between requests | 10,000 ÷ 60 ≈ 167 requests/s, the same rate as push below, bought by giving up the 5-second freshness target. |
Polling with ETag / If-None-Match | Same as plain polling | A version per resource | Empty polls become bodiless 304 Not Modified replies. That cuts bytes, not requests: still 2,000/s. |
| SSE to every tab | About one network trip after the event | 10,000 open connections, plus recent events kept for Last-Event-ID replay | 10,000 ÷ 60 ≈ 167 messages/s, all useful. Each deploy drops every connection at once, and they all reconnect together. |
| SSE behind several backend servers | One extra internal hop | Each server holds only its own tabs’ connections | The webhook lands on one server, but the customer’s tab may be connected to another. Publish each event on a shared channel that every server subscribes to. |
| Long polling | Near-instant | One parked request per client | One request per update plus one per timeout. A fallback where streams are blocked. |
| WebSockets | Near-instant, both directions | One open connection per client, with your own message protocol | Worth it only if the client talks back often. For server-to-browser only, SSE is plain HTTP. |
| Webhooks | The provider’s delivery delay, plus retry backoff while you are down | A queue and a table of processed event ids | One POST per event per subscriber, paid by the sender. You pay in endpoint security and idempotency. |
| Webhooks plus a reconciliation poll | Webhook speed normally; the poll interval in the worst case | A cursor: “changes since X” | A rare REST poll catches events lost after the sender gives up retrying. |
Polling pays for empty answers. Push pays for state: open connections for SSE, a dedupe table for webhooks. The flip point on the page says when the empty answers cost more than the state. Run it the other way to see the limit: if the same 10,000 tabs watched a live score that changes every 5 seconds, polling and push would both send 2,000 messages a second, every poll would find something, and polling’s lack of state would make it the simpler choice. Webhooks sit outside this sum because the browser is not involved: their cost is engineering on your side, paid once, not traffic per client.
Common mistakes
- Doing the work before answering the webhook
If your handler calls three services before returning 2xx, the sender times out and retries, and now you process the event twice. Verify, store the event, return 2xx, and do the work from a queue. Key the stored event by the provider’s event id with a unique constraint, so a retry that slips through anyway is rejected by the database instead of charging, emailing or shipping twice.
- Checking the signature on re-serialised JSON
The HMAC is computed over the exact bytes sent. Parse and re-serialise first, and whitespace or key order changes, so the check fails. Verify the raw body, compare in constant time, and if the provider signs a timestamp, reject old ones to block replays.
- Assuming webhooks arrive in order
Retries and parallel delivery mean “payment failed” can land before “subscription created”. Compare event timestamps or versions, or treat the webhook as a nudge and fetch the current state over REST. A handler that blindly applies events in arrival order can mark a recovered subscription as failed, because the older event happened to arrive last.
- SSE events with no id
EventSourcereconnects on its own, but it sendsLast-Event-IDonly if your events carried anid:line. Without ids, or without a server-side buffer to replay from, every reconnect silently drops what was sent in between. Number events in order per stream, so the server can find where to resume. - SSE through a buffering proxy, on HTTP/1.1
A proxy that buffers responses delivers events in clumps, or holds them until the buffer fills. Turn buffering off for the stream (on nginx,
X-Accel-Buffering: no) and send a comment line such as: pingto beat idle timeouts. Over HTTP/1.1 a browser allows about six connections per site, so a seventh tab’s stream stalls. Serve SSE over HTTP/2.
Which would you pick?
Three situations. Pick the side you'd actually build — the explanation follows.
Your payment provider must tell your backend when a charge settles, minutes or hours later.
The server initiates and the target is another server, which is the webhook case exactly. Polling burns requests waiting for something that may take hours, and SSE is for pushing into an open browser tab — your backend is not a UI holding a connection.
A dashboard tab must show progress updates live as a long job runs.
The last mile into an open UI is what SSE is for. A browser has no address a webhook can call — that is the distinction the page draws between server-to-server and server-to-browser. Polling every second works and spends a request per second per open tab to approximate a connection you could simply hold.
What does adopting webhooks cost you compared with REST?
With REST you call a service you chose and trust. With webhooks an unauthenticated request arrives claiming to be from your provider, so you must verify signatures, handle duplicates and tolerate retries — and the sender decides when. Exposing an endpoint is the smallest part of that.
Quick answers
REST, webhooks, or SSE — which should I use?
Use REST for standard client-initiated request/response. Use webhooks for server-to-server event notification, where your backend must expose an endpoint to receive it. Use SSE to push a live, continuous stream of updates to an open browser tab. Real systems typically use more than one together.
Why do webhooks need signature verification and idempotency handling?
Webhooks flip the usual client/server relationship — your server becomes the one receiving unsolicited requests, so it must verify the request genuinely came from the expected sender (signature verification) and handle the sender’s retries safely (idempotency), problems REST doesn’t have because the caller already trusts its own outbound request.
Is SSE the same as WebSockets?
No. SSE is one-directional — only the server pushes to the client, over plain HTTP, with built-in reconnect. WebSockets are bidirectional, letting the client send messages back over the same open connection. SSE is simpler and sufficient when the client only needs to receive updates.
Can these three be used together in one system?
Yes, and it’s common — for example REST to create a resource, a webhook to notify your backend asynchronously when something about it changes, and SSE to push that change live into an open UI, each handling the part of the flow it fits.
REST vs Webhooks vs SSE: who calls whom, and is the line open?
Explore the topic
See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.
More Handbooks
- The Kafka HandbookApache Kafka as a distributed append-only log, not a queue — topics, partitions and offsets, producers, consumers and consumer groups, per-key ordering, replication and ISR, delivery semantics (at-least-once and exactly-once), retention vs log compaction, and when Kafka beats a message queue.Read →
- Kafka vs RabbitMQThey both "move messages", which is exactly why teams pick the wrong one. Kafka is a durable, replayable log where consumers track their own offset; RabbitMQ is a smart broker that routes each message and deletes it on ack. The remember-vs-forget core difference, throughput and ordering trade-offs, and how to choose.Read →
- The WebSockets & Real-Time HandbookWhy "live" is hard on a protocol that can't push. Polling makes you wait on average half the interval to learn of an event (a 10s poll = ~5s staleness) and wastes a request every time nothing changed — and shrinking the interval only multiplies the waste. A WebSocket keeps one persistent full-duplex line open so the server pushes the instant something happens: latency ≈ one network hop, zero empty requests. The poll-vs-push latency math, when to use SSE instead, and the stateful-scaling pitfalls. With worked math and runnable code.Read →
- Kafka vs KinesisSame partitioned-log model underneath, different operational surface: Kafka is self-run and portable with a huge ecosystem; Kinesis is fully AWS-managed with a hard per-shard throughput ceiling. Retention, cost model, and the lock-in trade-off.Read →
- Streaming vs BatchBatch processes on a schedule; streaming reacts per-event. The real engineering cost of streaming isn’t speed, it’s correctness under disorder — event time vs processing time, watermarks, exactly-once semantics. The Lambda and Kappa architectures that combine both.Read →
- The Observability HandbookSeeing inside production — monitoring vs observability, the three pillars (metrics, logs, traces) and what each answers, structured logging, metric types and the cardinality trap, distributed tracing, the golden signals and SLIs/SLOs/error budgets, alerting on symptoms not causes, and correlating all three during an incident.Read →