Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

Handbooks  /  REST vs Webhooks vs SSE
Engineering~9 min readComparison
Head to Head

REST vs webhooks vs SSE: who initiates, who stays open?

RESTvsWebhooksvsSSE

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.

01

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.

→ The rule

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.

02

Head to head

DimensionRESTWebhooksSSE
DirectionClient pullsServer pushes to client’s endpointServer pushes over an open connection
ConnectionShort-lived, per requestShort-lived, one POST per eventOne persistent, long-lived connection
Who exposes a public endpointThe server (as usual)The client must expose oneOnly the server; client just connects out
Real-time-nessOnly as fresh as the poll intervalNear-instant, event-drivenContinuous, live
Delivery guaranteesN/A — one request, one responseNo built-in order/retry — you build itOrdered; built-in reconnect via Last-Event-ID
Browser supportUniversal (fetch)N/A — not a browser conceptNative EventSource, one-directional only
Best forStandard CRUD, on-demand dataServer-to-server event notificationLive UI updates pushed to a browser
Infra neededNone extraEndpoint + retry/idempotency/verificationServer holds one open connection per client
03

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
04

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.

→ The composition

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.

05

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.

→ The trade you’re actually making

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.

06

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.

→ The pattern generalizes

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.

→ The number

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

The picture: one billing flow, three wires

browser tab your backend provider 1 REST: POST 2 REST: charge REST client charges API 3 webhook POST public /hooks verify, dedupe signs, retries 4 SSE stream EventSource held open
Arrows show who opens each exchange. Steps 1 and 2 are REST: the caller opens a short connection and gets one answer. Step 3 reverses the direction. The provider opens a connection to you, which is why your backend needs a public endpoint, signature checks and a dedupe table. Step 4 is the only wire that stays open. The browser opened it earlier, so the server can push the moment the webhook lands. A browser has no public address, so the last mile cannot be a webhook. Notice where the waiting happens. REST waits on the caller’s schedule. The webhook arrives on the provider’s schedule, minutes or days after step 2. SSE turns that arrival into an update on screen with no further request, as long as the tab’s connection survived the wait.
Trade-offs

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.

CaseTimeSpaceWhy
REST polling every 5 sUp to 5 s stale, 2.5 s on averageNothing between requests10,000 ÷ 5 = 2,000 requests/s, and 11 of every 12 (91.7%) come back empty.
REST polling every 60 sUp to 60 s staleNothing between requests10,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-MatchSame as plain pollingA version per resourceEmpty polls become bodiless 304 Not Modified replies. That cuts bytes, not requests: still 2,000/s.
SSE to every tabAbout one network trip after the event10,000 open connections, plus recent events kept for Last-Event-ID replay10,000 ÷ 60 ≈ 167 messages/s, all useful. Each deploy drops every connection at once, and they all reconnect together.
SSE behind several backend serversOne extra internal hopEach server holds only its own tabs’ connectionsThe 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 pollingNear-instantOne parked request per clientOne request per update plus one per timeout. A fallback where streams are blocked.
WebSocketsNear-instant, both directionsOne open connection per client, with your own message protocolWorth it only if the client talks back often. For server-to-browser only, SSE is plain HTTP.
WebhooksThe provider’s delivery delay, plus retry backoff while you are downA queue and a table of processed event idsOne POST per event per subscriber, paid by the sender. You pay in endpoint security and idempotency.
Webhooks plus a reconciliation pollWebhook speed normally; the poll interval in the worst caseA 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.

Watch for

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

    EventSource reconnects on its own, but it sends Last-Event-ID only if your events carried an id: 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 : ping to 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.

Your call

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.

A dashboard tab must show progress updates live as a long job runs.

What does adopting webhooks cost you compared with REST?

Frequently asked

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.

▶  Watch it explained

REST vs Webhooks vs SSE: who calls whom, and is the line open?

REST vs Webhooks vs SSE · Vibe Engines · 2026
Finished this one? 0 / 209 Handbooks done
NextThe WebSockets & Real-Time Handbook Next on the “Networks, APIs and auth” ladder · rung 7 of 9

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Handbooks