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
1
vote
1 answer

Will GraphQL subscriptions push changes if the change is made not through GraphQL?

If I have a type : type Todo { id: ID! name: String! desc: String! } and mutations to create and get list of Todo objects : createTodo, and getListTodo everything is good so far. I noticed , the subscription, say : onCreateTodo, only…
Brotchu
  • 115
  • 1
  • 8
1
vote
1 answer

What means "sharing subscriptions/publishes"?

I am trying to understand the following part of documentation. Please note: By default graphql-subscriptions exports an in-memory (EventEmitter) event system to re-run subscriptions. This is not suitable for running in a serious production app,…
Pablo
  • 28,133
  • 34
  • 125
  • 215
1
vote
1 answer

How to setup ApolloServer and SubscriptionServer to use http and ws in graphql

I have been following the docs for here and here to implement the subscriptions-transport-ws plugin. My big confusion is differentiating the graphql url for http:// and ws://. In the examples above it looks like ApolloServer is getting replaced by…
1
vote
2 answers

How to prevent re-rendering with useSubscription()?

Many of you might have heard of GraphQL. It provides QUERY and MUTATION. Also it supports SUBSCRIPTION as 100% replacement of web socket. I'm a big fan of GraphQL and hooks. Today I faced an issue with useSubscription which is a hook version of…
tronx.dev
  • 138
  • 1
  • 11
1
vote
1 answer

React mock Graphql subscription

I have a react project, which I am testing using Jest. I am trying to mock a call to AWS graphql and in particular, a subscribe. Here is the code I am trying to mock await API.graphql( graphqlOperation(subscriptions.addedProduct)) …
Carl
  • 841
  • 1
  • 13
  • 33
1
vote
2 answers

How to do graphql subscriptions with Absinthe (Elixir) and Urql?

My idea was to build a client app using react and urql and a graphql api using elixir and absinthe but at the moment it looks as if these don't really play that well together. Is there a way to actually use the Absinthe subscriptions with any other…
1
vote
1 answer

Apollo useSubscription hook not emitting new data

I have created subscription whenever a new post is added. The subscription works fine on the graphiql interface. Here is my react code to use useSubscription hook export const SUSCRIBE_POSTS = gql` { subscription posts { newPost { …
1
vote
0 answers

How to keep track of online users in GraphQL using GraphQL-Java-Kickstart

Currently I am using ApolloSubscriptionConnectionListener. It contains 4 methods: onConnect, onTerminate, onStart and onStop. However onTerminate did not fire when I close my client. onStop seems to fire every time the client canceled the…
Tien Do Nam
  • 3,630
  • 3
  • 15
  • 30
1
vote
1 answer

How to get client ip address on an apollo subscriptions server?

How can I get the client's ip address on an apollo subscriptions server? Is it included anywhere in the .onConnect method here
perrosnk
  • 835
  • 2
  • 13
  • 23
1
vote
0 answers

Apollo Server - GraphQL's subscription websocket connection doesn't persist

I have been working with graphql subscriptions and have been able to implement it. It works fine without any issues when I host the same on local. But when I deploy it on a server with a idle_timeout set to 'x' seconds, it drops the connection to…
Sameer Sawla
  • 729
  • 6
  • 20
1
vote
1 answer

Any idea on how to handle 'graphql-redis-subscriptions' authentication when used together with apollo-server

I am using 'graphql-redis-subscriptions' from https://github.com/davidyaha/graphql-redis-subscriptions. Several examples are given on how to setup subscriptions and they actually work but the problem I am facing is how can I authenticate and allow…
PainPoints
  • 461
  • 8
  • 20
1
vote
0 answers

GQL union not retuning values

GQL union query not getting me the results Below is what I've done, type Body { content: Content } union Content = TextContent | BannerContent type TextContent { text: String } type BannerContent { banners: [Banner] } Front End…
aw3123
  • 139
  • 5
  • 18
1
vote
1 answer

How can I debug GraphQL subscriptions of a Django backend?

I'd like to add GraphQL subscriptions to a backend GraphQL API. Can I debug subscriptions with the graphene_django builtin GraphiQL? # /settings.py ... from graphene_django.views import GraphQLView urlpatterns = [ ..., …
thinwybk
  • 4,193
  • 2
  • 40
  • 76
1
vote
1 answer

Is it possible to push a payload at time of subscription registration using HotChocolate?

Using hotchocolate graphql server 10.3.5 w/ pure-code-first. Clients currently query and subscribe to receive changes, works fine. However, the query schema and subscription payload schema are often identical. I'd prefer that clients need only…
bunt
  • 302
  • 2
  • 13
  • 25
1
vote
1 answer

Amplify No pubsub module applied for subscription ReactJs

I am facing issue with subscriptions its throw exception No pubsub module applied for subscription index.js import Amplify from "@aws-amplify/core"; import PubSub from "@aws-amplify/pubsub"; import API from "@aws-amplify/api"; import config from…
Mina Fawzy
  • 20,852
  • 17
  • 133
  • 156