Skip to content

Commit

Permalink
[apollographql#11305]update subscriptions doc
Browse files Browse the repository at this point in the history
  • Loading branch information
gento-ogane committed Nov 9, 2023
1 parent 1847425 commit 79eeaad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/source/data/subscriptions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ npm install graphql-ws

Import and initialize a `GraphQLWsLink` object in the same project file where you initialize `ApolloClient`:

```js title="index.js"
```jsx title="main.jsx"
import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
import { createClient } from 'graphql-ws';

Expand All @@ -130,7 +130,7 @@ To support this, the `@apollo/client` library provides a `split` function that l

The following example expands on the previous one by initializing both a `GraphQLWsLink` _and_ an `HttpLink`. It then uses the `split` function to combine those two `Link`s into a _single_ `Link` that uses one or the other according to the type of operation being executed.

```js title="index.js"
```jsx title="main.jsx"
import { split, HttpLink } from '@apollo/client';
import { getMainDefinition } from '@apollo/client/utilities';
import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
Expand Down Expand Up @@ -168,7 +168,7 @@ Using this logic, queries and mutations will use HTTP as normal, and subscriptio

After you define your link chain, you provide it to Apollo Client via the `link` constructor option:

```js {6} title="index.js"
```jsx {6} title="main.jsx"
import { ApolloClient, InMemoryCache } from '@apollo/client';

// ...code from the above example goes here...
Expand Down

0 comments on commit 79eeaad

Please sign in to comment.