GraphQL Subscriptions vs Webhooks

Webhooks push to servers while subscriptions hold a live client channel.

Cover illustration for “GraphQL Subscriptions vs Webhooks”

GraphQL Subscriptions and webhooks both push updates without polling, but they put the work in different places. Webhooks deliver independent HTTP requests to a server. Subscriptions maintain a live channel to a client, usually over WebSocket.

Why GraphQL Subscriptions and Webhooks are not the same kind of real-time tool

“Real-time” describes an outcome. Both tools can notify a consumer when something changes, which makes them look interchangeable on a feature checklist. Underneath, however, a webhook sends a stateless HTTP POST to a registered endpoint, while a WebSocket subscription keeps a connection open for updates. One delivers a message. The other maintains a conversation.

How webhooks actually work: stateless HTTP POST, event ownership on the sender, retry on failure

A webhook sender owns the event trigger, and its consumer owns the receiving endpoint. When the specified event occurs, the sender issues an HTTP POST to the URL the consumer registered. Each delivery is an independent HTTP request. No connection stays open between events, but the receiving server must be reachable when delivery is attempted. The sender determines when there is news to send.

Failure handling depends on the provider’s delivery contract. With at-least-once delivery, the sender retries failed requests, including non-2xx responses, so the same event can arrive more than once. The consumer must make processing idempotent, so a duplicate does not repeat the action. Legalesign’s real-time events documentation states the ownership plainly with “Legalesign retries on failure.”

Stripe uses webhooks for payment lifecycle events including payment_intent.succeeded, invoice.paid, customer.subscription.deleted, and charge.dispute.created. Stripe retries deliveries for up to three days in live mode. Recovery therefore falls to the GitHub consumer. Neither provider guarantees event order, so a retried event can arrive after one generated later.

How GraphQL Subscriptions actually work: persistent WebSocket, client-defined shape, server pushes on event

GraphQL defines subscriptions with queries and mutations, but a subscription stays active. The client sends a subscription operation specifying the event and fields it wants, and the server maintains a pub/sub listener. When an event fires, the server sends the corresponding result down the connection the client opened. WebSocket establishes that channel with a single handshake. It is full-duplex, so either side can send without making a new HTTP request for every event.

The GraphQL layer determines the result’s shape. A client subscribing to projectVersionsUpdated, for example, can request exactly id, message, and createdAt. The same field-selection model used for queries applies to continuing updates. Over WebSocket, a subscription protocol sets the rules for this exchange. The current standard is graphql-ws, while the older subscriptions-transport-ws library is unmaintained and should not be used for new implementations.

WebSocket is not a requirement of GraphQL subscriptions themselves. The graphql-sse alternative delivers subscriptions over Server-Sent Events, providing an HTTP-based route where proxies or load balancers block WebSocket. The common WebSocket model nevertheless makes the failure split clear. If that connection drops, the client must reconnect, typically with exponential backoff. There is no corresponding server-side redelivery promise like a webhook sender’s retry policy.

What the persistent-vs-stateless split means for who carries the operational burden

Neither mechanism makes complexity disappear. Webhooks place much of it with backend and automation teams, which must handle duplicates, out-of-order events, endpoint availability, and signature verification. Subscriptions put more work with infrastructure and frontend teams through connection authentication, lifecycle management, backpressure, and load-balancer behavior. WebSocket authentication needs its own connection-time handling rather than an assumption that ordinary HTTP request authentication transfers unchanged. “Simpler” is incomplete unless it names whose work gets simpler.

Speckle’s comparison captures the scaling distinction by describing subscriptions as requiring an “active connection,” while webhooks “scale with HTTP endpoints.” A subscription server can keep its WebSocket connections in memory when there is only one process. A mutation on instance A cannot reach a client connected to instance B without a shared pub/sub layer. The second server is at the party but out of the group chat.

Redis pub/sub provides that shared channel, allowing an instance to publish an event that other instances receive and forward to their subscribers. That adds infrastructure that webhooks on their own do not need. Deployment constraints can be more decisive still. Serverless or edge functions that cannot retain persistent state between invocations cannot host these long-lived WebSocket connections. An HTTP receiver works with those functions without asking an invocation to stay for the evening.

Where webhooks are the correct choice and why the mechanism makes it obvious

Webhooks fit when the consumer is a server-side process that needs to act on an event. Backend automation, CI/CD pipelines, and serverless functions already have the right receiving model in an HTTP endpoint. For payment lifecycle events, the provider owns the trigger, and the service that receives the event carries out the action idempotently. Stateless delivery is not a compromise in this arrangement.

The same reasoning applies to backend-to-backend automation and “notify me when done” workflows. If a delay of seconds is acceptable and no interface needs intermediate updates, maintaining a live channel solves a problem the workflow does not have. Legalesign recommends webhooks for “backend integrations and automation” and for “systems behind firewalls that can receive HTTP but not hold WebSocket connections.” The receiving environment decides the fit. A firewall does not become more accommodating because the feature brief says “live.”

Managed delivery can also favor webhooks for teams that do not want to run connection infrastructure. Major providers offer managed webhook delivery, although their retry contracts still need scrutiny, as GitHub demonstrates. The subscription hosting landscape became narrower when Apollo discontinued its cloud routers in early 2026. That changes the operational comparison for teams relying on managed infrastructure. It removes a hosting option from the calculation.

Where GraphQL Subscriptions are the correct choice and what they add beyond plain WebSocket

GraphQL Subscriptions fit best when an interactive application needs instant updates and already uses GraphQL for queries and mutations. A live dashboard or collaborative editor benefits from a persistent channel because users need changes as they happen. Granular progress during file ingestion or upload pipelines likewise calls for intermediate states.

GraphQL adds a schema contract to the transport. Clients can subscribe to different filtered event streams and choose just the fields they need, so the payload has less data they will not use. Queries, mutations, and subscriptions can share types, a client library, and an authentication approach established at connection time. Plain WebSocket supplies the channel. A team already using GraphQL can extend its existing contract instead of rebuilding those conventions for live updates.

Without an existing GraphQL API, the calculation changes. Introducing a GraphQL server solely for subscriptions can cost more than the shared type system saves, making SSE or plain WebSocket the better fit. Even those may be unnecessary for infrequent updates. When the application can tolerate polling, it is simpler and more robust than maintaining a WebSocket connection. Subscriptions earn their upkeep through genuinely low latency or many simultaneous update streams.

Using both together: the webhook-to-subscription bridge pattern

Many systems need both backend automation and an interface that responds quickly, so each mechanism has a place in the same system. An external payment provider, CI service, or third-party API posts a webhook to a receiver in the backend. That backend publishes the event to a shared pub/sub channel such as Redis. The subscription server listens to the channel and forwards matching events to connected clients. The frontend receives a typed, field-selected update without needing to know it began as an HTTP POST.

The handoff needs a buffer or queue between the webhook handler and the subscription layer. That boundary decouples delivery timing and separates security concerns rather than exposing the raw webhook handler directly to subscriptions. Each leg retains its own responsibilities. The webhook side follows the sender’s delivery policy, while the subscription side manages persistent client connections and low-latency updates. Legalesign endorses the combination as “subscriptions to update your UI and webhooks to trigger backend workflows.”

Three recent developments that change the operational calculus in 2026

Apollo’s cloud router discontinuation removed a managed option in March 2026. Apollo’s documentation said Serverless cloud-router availability would end on February 15, 2026, and Dedicated cloud-router availability would end on March 15, 2026. Teams that use those services must move to a self-hosted router or another managed platform. Hasura DDN is an alternative, but subscriptions on that platform are currently in beta. For an adopting team, the hosting decision now requires more care than simply assuming the former managed route remains available.

Shopify made its REST Admin API a legacy API on October 1, 2024, and required all new public apps to use the GraphQL Admin API exclusively from April 1, 2025. Shopify’s webhook reference directs apps to register webhooks through the webhookSubscriptionCreate mutation. Using GraphQL to configure delivery is not the same as delivering updates over WebSocket.

Shopify’s Next Generation Events then introduced filterable, GraphQL-defined event subscriptions configured in an app’s TOML, replacing fixed-payload topic subscriptions. The feature was in Developer Preview on the unstable API version as of May 2026. Shopify said clearly that teams should not use the feature in production during that preview. The stable release arrived on October 1, 2026, with API version 2026-10, ending that preview restriction. Webhooks are still the right choice for live order pipelines, even as the ways to configure them and choose events change.

Apollo Client’s documentation recommends graphql-ws and labels subscriptions-transport-ws unmaintained. The two protocols are mutually unintelligible, so mismatched client and server implementations typically close immediately with a protocol error. Similar names do not make them compatible. Meanwhile, graphql-sse reduces the proxy and load-balancer complications associated with WebSocket, weakening the assumption that a network blocking WebSocket necessarily blocks GraphQL subscriptions.

A decision framework based on mechanism, not use-case checklists

The connection’s location and responsibility for keeping it alive provide a durable starting point. For a server-side consumer, independent HTTP requests usually fit naturally, especially when the receiver is a serverless function. The remaining questions concern delivery guarantees, duplicate handling, ordering, and recovery under the provider’s actual policy.

For an interactive browser or desktop client already using GraphQL, a persistent subscription can justify its cost through latency and shared types. If updates can be infrequent, polling avoids connection management instead. If the application is not otherwise on GraphQL, SSE or plain WebSocket avoids introducing an entire API layer for one feature. When backend workflows and a live interface both need the event, the bridge pattern gives each its own mechanism. There is no prize for making one tool do both jobs.

Use graphql-ws for WebSocket or graphql-sse for HTTP-based environments, and plan for Redis pub/sub from the start when deploying to more than one instance, because tutorial-style in-memory pub/sub will not meet that need as the system grows. Hosting also needs an explicit choice after Apollo’s shutdown.

Sources

  1. Real-Time Events

    Supplied the guidance on when to choose webhooks versus subscriptions, including the retry statement and the combined UI-and-backend pattern.

  2. Subscriptions - Speckle Docs

    Provided the subscription example with projectVersionsUpdated and the comparison of active connections versus HTTP endpoint scaling.

  3. Subscriptions - Apollo GraphQL Docs

    Supported the recommendation of graphql-ws and the warning that subscriptions-transport-ws is unmaintained.

  4. Overview of GraphQL Subscription Support - Apollo GraphQL Docs

    Informed the discussion of Apollo's cloud router discontinuation dates and the hosting implications for subscriptions.

  5. WebSocket Recovery for GraphQL Subscriptions

    Informed the points on reconnection after a dropped WebSocket and the lack of server-side redelivery for subscriptions.

AllAboutAPIs Editors