-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
UseSubscription does not subscribe to subscription #5996
Comments
@Antoine-C did you manage to fix this? |
@martimalek I gave up for the moment and used socket.io for the subscription |
Thanks for the quick answer, sadly I'm on the verge of also giving up... |
Maybe it is the same as this issue |
A lot of the Apollo Client internals have changed since v3 was launched. We recommend trying a more modern version of |
hello there. I have similar issue. I use pure Apollo Server on back. and when I subscribe to events in playground, everything work fine and I have correct responses when events happen. however if I try to use useSubscription hook (to be precise I use gel generated types, so this is useNewPostSubscription instead of useMutation), I have no response at all. the parameter loading is always true and I never get into subscription section (I know t since I have several console logs in there). can you please help me with my issue |
actually I tried to replace useNewPost with useSubscription and got exactly the same situation as before |
Intended outcome:
I'm trying to setup subscription with react hooks and apollo-client. I'm using apollo-server-hapi in the backend to handle GraphQL with Hapi. I'm pretty confident my backend is setup correctly given I can see when a new client subscribe and furthermore I can get subscription to work with graphiql.
Client setup
index.js
In my component
Server setup
index.ts
More infos
I can see the webscoket connecting to my API in chrome devtools and as I said earlier when I use GraphiQL I can see the log in my server "Someone subscribed to this event".
To finish I can see in XHR that a POST request is made to my API with the subscription content (I guess it's to tell Apollo server someone want to subscribe to this subscription ?)
Chrome devtools
Actual outcome:
I can't get the frontend to subscribe to the somethingChanged subscription however we I open graphiql at http://localhost/graphql and I put the exact same content as in COMMENTS_SUBSCRIPTION I can see that everything is working as expected.
How to reproduce the issue:
I've put as much code as I can to be as thorough as possible to explain my problem.
Version
Infos
The text was updated successfully, but these errors were encountered: