React Native Apollo Client does not trigger subscriptions events #220
Unanswered
BraveEvidence
asked this question in
Q&A
Replies: 1 comment 10 replies
-
Hi there, sadly, I have very little experience with React Native and absolutely none with Apollo. Can you please confirm that the library itself is working, without Apollo's tooling? You can do so by using the client directly (without any Apollo links). Roughly: import { createClient } from 'graphql-ws';
const client = createClient({
uri: 'ws://my_url/graphql',
retryAttempts: 0,
connectionParams: () => {
return {
Authorization: `Bearer MY_TOKEN`,
};
},
isFatalConnectionProblem: () => true,
});
client.subscribe({
query: 'subscription SomeSubscription { someSubscription }' // put a subscription you've been trying out with Altair here
}, {
next: (msg) => console.log('next', msg),
error: (err) => console.error('error', err),
complete: () => console.log('complete');
}); If the console yields the expected logs from the subscription, the issue lies in Apollo. If so, I'd suggest you open an issue on their side instead - as there is nothing I can do. Also, please share which backend are you using and ideally the code of how you implement |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am using graphql-ws for managing subscription in my React Native app as well in my backend server. It works fine in my backend server and I have tested it with Altair client. I am not using subscriptions-transport-ws library in frontend or in backend.
I even went through this issue #130 but it is not working for me
Here is my code for subscription in my react native app
Can you tell what could be the issue from my frontend. I don't see any errors in logs
Beta Was this translation helpful? Give feedback.
All reactions