-
Notifications
You must be signed in to change notification settings - Fork 2k
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 subscription connectionParams in GraphiQL #548
Add support for subscription connectionParams in GraphiQL #548
Conversation
@Glockenbeat: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
LGTM but i think we need a better naming, at least adding websocket before so it will be |
Would be possible of course, however I tried to stick to the naming which is used for the SubscriptionServer onConnect() method in the authentication example. Should we change it anyways? |
Updated the naming as proposed, so it's "websocketConnectionParams" now. |
Thank you guys! I was trying to implement some logic with cookies passed from the server.When the authorization header from the first graphiql request was passed to the client on second request for subscription cookies are passed trough socket and then the server verifies the token again. Waiting for this to be merged :) |
I came to suggest this very thing and found it almost done. Awesome! I have one possible change: Perhaps the item passed to websocketConnectionParams: {
authToken: localStorage.getItem('AUTH_TOKEN'),
}, which is what we use on the client, but since I'm setting this up on the server, websocketConnectionParams: `{
authToken: localStorage.getItem('AUTH_TOKEN'),
}`, We already do this with |
@Glockenbeat @DxCx: What do you think of @rdickert's proposal? |
I like the idea of being able to use data from the client rather than setting it in the GraphiQL connection settings on the server. Something like that is definitely needed. Personally I don't really like how the values are passed as a string as they are implicitly executed on the client, but since that is already implemented in the same way for passHeader it should be fine to use here as well. |
Would it be possible to merge this PR and iterate on it afterwards? So far the discussion seems to be a bit stuck but I think this could be helpful for some people to work with connectionParams and websockets, even when there might be better implementations in the long run. |
@Glockenbeat: I'd be happy to merge this if other people agree. @DxCx? @rdickert? |
Yeah let's do it! |
Is there any way to pass an auth token from local storage with |
This PR adds the ability to pass connectionParams to the GraphiQL options in the GraphiQL plugins (solved #452).
TODO: