subscriptionExchange and SSR #1087
Answered
by
kitten
aldis-ameriks
asked this question in
Q&A
-
What's the optimal way to handle I'm now doing the following, which seems to work. But made me wonder what's the recommended way and/or how others are handling it? if (!isServerSide) {
const subscriptionClient = new SubscriptionClient(config.apiGraphqlWsEndpoint, { reconnect: true });
exchanges.push(
subscriptionExchange({
forwardSubscription(operation) {
return subscriptionClient.request(operation);
},
})
);
} |
Beta Was this translation helpful? Give feedback.
Answered by
kitten
Oct 27, 2020
Replies: 1 comment 2 replies
-
I'm not quite sure what the question here is. By default |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
aldis-ameriks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not quite sure what the question here is. By default
useSubscription
shouldn't be taken into account for SSR, meaning that no subscription will actually be executed for runs usingreact-ssr-prepass
for instance. So it's safe to either add asubscriptionExchange
or leave it out for SSR.