5

I wanted to change the graphql websocket end point inside graphql, anyone know how to do this?

by default it pings

wss://localhost/graphql

I need to change it to pusher url

thanks :-)

Jagadesha NH
  • 2,529
  • 2
  • 23
  • 41

1 Answers1

8

If you are running a standalone instance of GraphQL Playground, the URL is passed directly to the component as a prop:

<Playground
  endpoint="http://localhost/graphql"
  subscriptionEndpoint="wss://localhost/graphql"
/>

If you're using apollo-server, the endpoint URL should be derived from the subscriptionsPath, but it can also be set directly in the config:

const server = new ApolloServer({
  typeDefs,
  resolvers,
  playground: {
    subscriptionEndpoint: 'wss://localhost/graphql',
  },
});

EDIT:

It doesn't appear there's a way to configure the desktop client with a specific subscription URL, unless you're using it with a local repo that contains a .graphqlconfig. In that case, you can provide additional information about your environment, including the subscription url, in the config file as outlined here.

Daniel Rearden
  • 80,636
  • 11
  • 185
  • 183