Content Deep Dive
How to Use Subscriptions in GraphiQL
Blog post from Apollo
Post Details
Company
Date Published
Author
Uri Goldshtein
Word Count
606
Language
English
Hacker News Points
-
Summary
The GraphiQL library already supports subscriptions, allowing users to configure their own transport and enabling live-stream subscriptions into the app's GraphiQL editor. To use this feature, developers need to add a new field called `subscriptionsEndpoint` to the `graphiqlExpress` config with the Websocket URL of the subscriptions endpoint. This allows users to write GraphQL subscriptions queries in GraphiQL, which will be pushed into the client and displayed in real-time, using a plug-and-play solution provided by the `graphql-subscriptions-fetcher`. The feature is available for use with various server frameworks such as Express, Hapi, Koa, Restify, and Lambda.