2

I have got a problem.

The scenario is we have two graphql servers.

I have split them passing context in the query/mutation options.

It works but I also have two different websocket setup.

As we can split subscription using hasSubscription(operation.query). It can be split only depending on query type.

But as I mentioned I have two websockets and I see there is no option to pass context in useSubscription like useQuery/useMutation.

Here is the documentation: https://www.apollographql.com/docs/react/data/subscriptions/#subscribetomore

There is no option to pass context in the subscription.

So what's the right way to achieve this?

Note: I'm using reactjs here.

1 Answers1

0

try using useSubscription hook with client option. Thank you.

https://www.apollographql.com/docs/react/data/subscriptions/#useSubscription

Tanu
  • 1,286
  • 4
  • 16
  • 35