Skip to content

Unable to run graphql-ws with graphql-compose #223

Answered by enisdenjo
ziedHamdi asked this question in Q&A
Discussion options

You must be logged in to vote

Disclaimer: I have no experience with graphql-compose whatsoever.

To provide a contextValue to graphql resolvers, you have to supply the context option. Please check the "ws server usage with custom context value" recipe.

The roots option is a convenience that gets injected to the rootValue during graphql's execute or subscribe by operation type.

execArgs.rootValue = roots?.[operationAST.operation];

In your case (from the referenced issue), the roots option can be completely omitted as it does nothing anyway.

arg2 (aka args) are arguments provided to the field in the GraphQL query. You supply them from the client.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ziedHamdi
Comment options

Answer selected by enisdenjo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #222 on August 11, 2021 09:44.