This example demonstrates a basic subscription operation in Apollo Server. See the docs on subscriptions
The example server exposes one subscription (progressData
) that returns an object:
{
status: String;
propId: String;
ticker: String;
}
After you start up this server, you can test out running a subscription with the Apollo Studio Explorer by following the link from http://localhost:4000/graphql to the Apollo Sandbox. You might need to edit the Apollo Sandbox connection settings to select the graphql-ws
subscriptions implementation. You'll see the subscription's payload property ticker
value update every second.
subscription progressData($propId: ID!, $deviceId: String!) {
progressData(propId: $propId, deviceId: $deviceId) {
status
propId
ticker
}
}
npm install
npm run dev