Skip to content
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

``` #525

Open
Sonyashines opened this issue Sep 30, 2023 · 0 comments
Open

``` #525

Sonyashines opened this issue Sep 30, 2023 · 0 comments

Comments

@Sonyashines
Copy link

const createApolloClient = authToken => {
  return new ApolloClient({
    link: new WebSocketLink({
      uri: "wss://url/v1/graphql",
      options: {
        reconnect: true,
        connectionParams: {
          headers: {
             Authorization: `Bearer ${authToken}`
          }
        }
      }
    }),
    cache: new InMemoryCache()
  });
};

@k96white This is working for me with subscriptions and ws subscription but carrefull with http link instead of ws link, syntax is not the same:

const createApolloClient = (authToken) => {
  return new ApolloClient({
    link: new HttpLink({
      uri: "https://hasura.cairncross.ovh/v1/graphql",
      headers: {
         Authorization: `Bearer ${authToken}`
      },
    }),
    cache: new InMemoryCache(),
  });
};

Originally posted by @clementvp in hasura/nodejs-graphql-subscriptions-boilerplate#3 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@Sonyashines and others