GraphQL Playground: How to set subscription connectionParams?

Viewed 1157

I have a secure subscription endpoint on my apollo server. I can send subscription connectionParams from my react client by setting it in the WebSocketLink constructor and verify it in the onConnect property of ApolloServer constructor. But how do I test these subscriptions on GraphQL Playground? If I set the HTTP Headers on my subscriptions tab, it doesn't work. Is there any way to set this option in GQL playground?

1 Answers

connectionParams can be passed using the HTTP HEADERS tab, at the bottom left corner of the graphql playground.

Example: Let's say you wanted to pass the authToken parameter to your socket connection you could do it in the following way:

{
  "authToken": "sometoken"
}

screenshot

Related