Questions tagged [graphql-subscriptions]

GraphQL subscriptions are a way to push data from the server to the clients that choose to listen to real time messages from the server.

In addition to fetching data using queries and modifying data using mutations, the GraphQL spec supports a third operation type, called subscription.

Subscriptions in GraphQL and Relay

Subscriptions in GraphQL and Apollo

280 questions
3
votes
0 answers

React Apollo: GraphQL Subscription hangs on loading

I'm having trouble with GraphQL Subscriptions in React-Apollo. The issue is that when I create a subscription it gets stuck on loading forever. Despite that, the GraphQL Subscriptions work in gql-playground so it seems like a front-end issue. I've…
SpikeThea
  • 340
  • 1
  • 3
  • 13
3
votes
0 answers

Is it possible to handle disconnects in graphQL on server side?

I'm doing a graphQL subscription and I need to catch the moment when a client disconnects (intentionally or by timeout) and do some work like clean caches and unsubscribe RX subscriptions. Is that possible? I'm using graphql-spring-boot-starter with…
Tony G
  • 83
  • 7
3
votes
1 answer

GraphQL Playground: How to set subscription connectionParams?

I have a secure subscription endpoint on my apollo server. I can send subscription connectionParams from my react client by setting it in the WebSocketLink constructor and verify it in the onConnect property of ApolloServer constructor. But how do I…
3
votes
2 answers

Apollo Server Subscription subscribe method is never called

I have an existing Express ApolloServer . I added subscription to that . I can see when I fire the subscription from Playground, the resolve method is called . But, the subscribe method is never called const { PubSub, withFilter } = require…
3
votes
1 answer

Android apollo subscriptions not working?

I need to integrate subscription in my Android app. The subscription works fine on localhost in graphiql. I have deployed my backend on Heroku. I am using apollo-server and not hasura. My subscriptions are not working for the url given by Heroku but…
3
votes
1 answer

Is there a way to debug Apollo GraphQL subscriptions in Chrome DevTools?

In the Network tab of the Chrome DevTools, I can only find GraphQL queries and mutations requests: While listening to a GraphQL subscription, and receiving a response, nothing appears in this tab. Is there another place to fetch GraphQL…
3
votes
0 answers

GraphQL Subscriptions return an empty (null) response

I have an issue with a very simple GRAPHQL server trying to make subscriptions work. Using pubsub to subscribe and publish an event when a user signs in. On signing in, the mutation completes successfully, but the corresponding subscription returns…
3
votes
0 answers

How to implement subscriptions in graphql.js?

This is a pretty simple question. How to implement subscriptions in graphql? I'm asking specifically for when using graphql.js constructors like below ? I could not find a clean/simple implementation. There is another question here, but it deals…
AIon
  • 12,521
  • 10
  • 47
  • 73
3
votes
1 answer

How to Configure uwsgi + nginx + Django + websocket?

I successfully deployed uwsgi + nginx + Django. But I want to communicate with my server using websocket. I followed this tutorial to handle normal https requests. https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html The nginx…
Grateful
  • 383
  • 5
  • 18
3
votes
0 answers

How to update cache using subscriptons in apollo-client?

In my react app, I have a component PageList (query) using subscribeToMore to update in real-time... When I change to another route in my app, that subscription is closed (the list component is unmounted)... But if another client add something to…
3
votes
0 answers

Subscriptions are not stable. Prisma terminates with a GqlConnectionTerminate error

I just implemented subscriptions in my API which use graphql-yoga. I have one prisma server which have the following config: databases: default: connector: postgres host: database: prisma port: 5432 user: admin password:…
Chrishan
  • 4,076
  • 7
  • 48
  • 67
3
votes
0 answers

aws-amplify [ts] Property 'subscribe' does not exist on type '{}'. [2339]

I'm new to aws amplify. I have setup an app using amplify and I have an API that is returning records using GraphQl. I have created a subscription that is supposed to be triggered when creating a new blog entry. The entries are being created. In the…
Jimi
  • 1,867
  • 7
  • 31
  • 55
3
votes
3 answers

Spring boot graphql-java and subscriptions

The following example https://github.com/graphql-java/graphql-java-subscription-example which use's graphql-java for subscriptions over a websocket. How can the same idea be done within the spring version? GraphQLSubscriptionResolver needs to return…
user101010101
  • 1,609
  • 6
  • 31
  • 52
3
votes
3 answers

Apollo GraphQL server; setting context to handle requests triggered by a fired subscription

I understand how to set the context object when creating a GraphQL server e.g. const app = express(); app.use(GRAPHQL_URL, graphqlExpress({ schema, context: { foo: 'bar' }, })); so that the…
wabrit
  • 217
  • 2
  • 14
3
votes
1 answer

Apollo subscription not working

I have a graphql server and I'm attempting to trigger an event whenever the status of an entity is updated. I have a mutation for updating the entity, which uses graphql-subscriptions to publish the update for the subscriber to listen to. However,…
Ewan Valentine
  • 3,741
  • 7
  • 43
  • 68