-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
React Native Apollo Client does not trigger subscriptions' events #130
Comments
Hey there, 2 questions:
|
Thank you for the promptly reply.
Side question: do you have experience in using that library with mobile apps (i.e. React Native)? I am still checking if it is worthing migrating from Once more, thank you for helping. |
Hi @rgbedin! I'm in the process of migrating three React Native apps from The backwards compatibility example in the README was what I followed to make the back-end compatible with |
This is great, thank you for sharing. What was the motivation behind the migration? Did you experience connection issues using Would you be able to prove your implementation of |
The The reason for the switch was that after about a year of inexplicable bugs - mainly clients that did not receive any subscription even though they appeared to be connected - we discovered that the issue was this bug in
In our system, the connection params sent with the initial handshake are stored inside the GraphQL context, and are accessed every time a subscription is established. Since subscriptions are re-established before the handshake completes, after a reconnection all our subscriptions would fail with something like |
I see, I believe this might be the issue happening on my side as well. I have not put a lot of investigation into that; I was under the assumption my client was not connected. From your description it's very likely the client might be connected, but does not receive the event -- because that was the only thing I was actually checking. Thank you for shining a light into this. We will probably proceed with the migration as well. |
Hey @rgbedin, if you're satisfied with the answers please close the issue; if not, feel free to ask more questions. 😄 |
If the server implements the unmaintained Wish this was posted somewhere easier to find. Spent hours trying to figure out why I couldn't connect with the default client example shown in the readme. My backend is a java GraphQL server using com.netflix.graphql.dgs and I'm guessing this may be the issue as I can connect fine using apollo-client (through vue-apollo). Anytime I try to subscribe using graphql-ws it fails with a 1006 error code. |
The server implementation in But yeah, I get that rather often. I, therefore, added a disclaimer right in the main readme. |
I have put this on hold and did not make further investigations on it. Sorry. |
@rgbedin ok thanks |
Hello everyone! Thanks for making this library and providing support for the community.
I am trying to use it in a React Native application but it seems I am doing something wrong, because the subscriptions are fired by the server, but I don't receive anything on my client.
Please note that I migrated from the old
subscriptions-transport-ws
library - everything was working fine using that and theWebSocketLink
implementation by@apollo/client/link/ws
. However I decided to migrate since that library seems to not have been in active development and the docs recommended using this new one. Moreover, I am having issues with the connection dropping on mobile with the old lib. This is why I wanted to give this one a shot.This is my
WebSocketLink
implementation:And this is how I am creating the link:
In order to create the subscription, I am using the
useSubscription
hook by@apollo/client
:Package versions:
@apollo/client: 3.3.11
react-native: 0.63.4
Could you give some insight on what I might be doing wrong? Again, this setup works fine if I use
import { WebSocketLink } from "@apollo/client/link/ws"
. Thank you.The text was updated successfully, but these errors were encountered: