Fix zeus generated file when using graphql-ws subscriptions and Node #390
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The file generated by Zeus is missing a few things when using both the
--n
(target Node) and--subscriptions graphql-ws
(subscriptions withgraphql-ws
lib instead of the legacy websocket client):Headers
type from@types/node-fetch
as the type definition is not compatible with the one from TS lib DOM (Headers in the browser).webSocketImpl
param must be passed to thecreateClient
function, as Node doesn't have an out-of-the-box implementation of WebSocket as the browsers doPoint 1 creates a
tsc
compile time error.Point 2 creates a runtime
graphql-ws
error.Open question:
What to do with the
apiSubscription
function? I didn't know out to distinguish between the node or the browser for this function and how we could pass it a WebSocket implementation in the case of Node and graphql-ws.