4. Subscriptions over HTTP Callbacks
10m

Overview

With HTTP callbacks, a uses a callback URL provided by the to send new data as soon as it becomes available. This process occurs without maintaining a long-lived, resource-intensive connection—instead, the "checks in" periodically with the router.

A visual showing the router and the subgraph involved in an HTTP callback

Process at a glance

There are three primary roles involved in this process: the , the , and the emitter.

A visual of the three roles involved in the HTTP callback process: the router, the subgraph, and the emitter

The receives the , and breaks it up to fetch data from each responsible . In addition, it tells the subgraph(s) that provide data how to "call back" when new data is available.

The emitter is the mechanism that checks in with the periodically and "emits" new data. (This can be a separate service—or the itself.)

The subgraph's roles & responsibilities

  • Receive from
  • Establish connection with the
  • Retrieve and return data
  • Manage periodic check-ins

The also needs to be running a framework that has implemented support for the HTTP Callback Protocol. This comes out of the box with .

Note: Because our takes on the role of both subgraph and emitter, it's handling the last step, periodically checking in with the .

The router's roles & responsibilities

  • Receive from clients, break them up across the , and return the response
  • Set the HTTP callback configuration:
    • Define path and port
    • How often the should check in
    • Which support s
Previous

Share your questions and comments about this lesson

Your feedback helps us improve! If you're stuck or confused, let us know and we'll help you out. All comments are public and must follow the Apollo Code of Conduct. Note that comments that have been resolved or addressed may be removed.

You'll need a GitHub account to post below. Don't have one? Post in our Odyssey forum instead.