-
Notifications
You must be signed in to change notification settings - Fork 735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for websocket endpoint with graphql-ws #1326
Conversation
|
When can we expect this to be merged in? |
@lethot We can have more features by adding GraphQL Tools Url Loader as in this PR. What do you think @acao ? |
Any updates? |
const client = createClient({ | ||
url: this.state.endpoint, | ||
retryAttempts:0 | ||
}); | ||
const unsubscribe = client.subscribe( | ||
{ | ||
query: `{ | ||
__schema { | ||
queryType { | ||
kind | ||
} | ||
} | ||
}`, | ||
}, | ||
{ | ||
next: () => { | ||
this.setState({ valid: true }) | ||
unsubscribe() | ||
}, | ||
error: () => { | ||
this.setState({ valid: false }); | ||
unsubscribe() | ||
}, | ||
complete: () => {}, | ||
}, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simpler way to achieve the same check would be by disabling lazy
mode (connect on instantiation) and check if the client connected
.
const client = createClient({ | |
url: this.state.endpoint, | |
retryAttempts:0 | |
}); | |
const unsubscribe = client.subscribe( | |
{ | |
query: `{ | |
__schema { | |
queryType { | |
kind | |
} | |
} | |
}`, | |
}, | |
{ | |
next: () => { | |
this.setState({ valid: true }) | |
unsubscribe() | |
}, | |
error: () => { | |
this.setState({ valid: false }); | |
unsubscribe() | |
}, | |
complete: () => {}, | |
}, | |
); | |
const client = createClient({ | |
url: this.state.endpoint, | |
retryAttempts: 0, | |
lazy: false, | |
on: { | |
closed: () => this.setState({ valid: false }), | |
connected: (socket) => { | |
this.setState({ valid: true }); | |
client.dispose(); // dispose after validation | |
}, | |
}, | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oof, I forgot to commit this suggestion. @lethot or @enisdenjo can you follow on a PR with this correction?
Any news? |
What's blocking from getting this merged? Any way to help? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This says that it was merged on 25th April but I don't see any newly published graphql-playground-html packages since 1yr ago: https://www.npmjs.com/package/graphql-playground-html (1.6.30 @ 11/4/2021 6pm). Is this merged item available anywhere? |
Changes proposed in this pull request: