Sometimes you need to not only query data from a server, but you also want to push data from the server to the client. GraphQL-core 3 has you also covered here, because it implements the “Subscribe” algorithm described in the GraphQL spec. To execute a GraphQL subscription, you must use the subscribe() method from the graphql.execution package. Instead of a single ExecutionResult, this function returns an asynchronous iterator yielding a stream of those, unless there was an immediate error. Of course you will then also need to maintain a persistent channel to the client (often realized via WebSockets) to push these results back.

Other Usages

GraphQL-core 3 provides many more low-level functions that can be used to work with GraphQL schemas and queries. We encourage you to explore the contents of the various Sub-Packages, particularly graphql.utilities, and to look into the source code and tests of GraphQL-core 3 in order to find all the functionality that is provided and understand it in detail.