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
2
votes
1 answer

Unable to understand GraphQL Subscriptions using ActionCable with graphql-ruby gem

I am trying to implement GraphQL Subscriptions using ActionCable with graphql-ruby gem. I figured out from this link that GraphQL channel needs to be created to which clients needs to subscribe. Normally, in ActionCable, we will stream_from…
2
votes
1 answer

graphql-subscription not working consistently

We are using graphql-subscription in our application in this manner: When deletion event is arriving into server: pubsub.publish('onDeleteItem', {onDeleteItem: [msg.payload.ItemId]}); Resolvers: Subscription: { onDeleteItem: { subscribe: () =>…
S123
  • 31
  • 5
2
votes
1 answer

Apollo Subscriptions not listening to new data on client

Previously my apollo setup was listening to subscriptions until I added in socket.io and now my client setup is no longer listening to new data. my server codes seem to be ok based on my testing using graphql playground. in my browser console, i get…
Hendry Lim
  • 1,929
  • 2
  • 21
  • 45
2
votes
3 answers

GraphQL Subscriptions - subscriptionsClient.subscribe is not a function

So, I'm trying create a basic GraphQL Subscription Server. Problem in request result in graphiql. It's - "subscriptionsClient.subscribe is not a function". I don't understand where's problem. For GraphQL Subscription Server I have used:…
oles
  • 166
  • 1
  • 2
  • 10
2
votes
1 answer

GraphQL/Prisma Subscriptions only fire for DELETE

I have set up a project using Prisma for handling the communication/storage/retrieval of data to and from the server. It is essentially the same architecture as here example. The only major difference is that my resolvers aren't separated into…
A.Smith
  • 427
  • 5
  • 14
2
votes
1 answer

User specific publish (subscriptions)

Here's a small issue I faced and couldn't find much info in the documentation. I am trying to create private chat messages. We have the following code to subscribe a user to a topic: export const resolvers = { Subscription: { somethingChanged:…
pewpewlasers
  • 3,025
  • 4
  • 31
  • 58
2
votes
0 answers

How do I perform a mutation with the guarantee that the subscription is ready?

Previously, in the GraphQL protocol there was a special message confirming the subscription: SUBSCRIPTION_SUCCESS (server -> client). Now it is deprecated: here in apollographql and here in prismagraphql. Why is it no longer necessary? I am…
2
votes
1 answer

How to catch rejected graphql subscription in jest / apollo client?

Using graphql-yoga I am attempting to write jest tests to cover subscriptions. I am able to successfully test the happy path were a subscription works (with auth). Unfortunately I am not able to test the situation where a subscription websocket…
2
votes
0 answers

Graphql subscriptions fails with Redis implementation

I have an application composed of two parts: a React frontend which makes use of graphql-subscriptions and a Node.js app with an MQTT broker (and its web socket handler) and a subscription server. As stated here, instead of using the default PubSub…
Chris
  • 1,140
  • 15
  • 30
2
votes
1 answer

Fire QraphQl subscription resolver multiple times per single change

Working with GraphQl subscriptions I`m facing a curious issue. For purpose of real-time updates, I use MongoDB Change Stream feature on a server (NodeJs) and GraphQl subscriptions for front-end (Angular). So, when some changes appear in database its…
Nick
  • 177
  • 1
  • 13
2
votes
0 answers

GraphQL: Adding subscription to schema

I am trying to setup subscriptions with GraphQL and Relay. I have the following mutation which adds a new team: const createTeamMutation = mutationWithClientMutationId({ name: 'CreateTeam', inputFields: { ownerId: { type: new…
Mary Cahill
  • 163
  • 3
  • 12
2
votes
1 answer

`updater` not working correctly when using subscriptions in Relay Modern

I'm using Relay Modern in my app and have successfully integrated subscriptions using the requestSubscription function. All works well and the updater function that I use to update the cache gets called correctly with the proper subscription…
nburk
  • 22,409
  • 18
  • 87
  • 132
2
votes
0 answers

Component not updating after view changes in Angular2

I have two components (siblings). I have also defined a service which is responsible for interacting with my api. However, after I make changes in one component, I expect the changes to reflect in my other component as well. However, for some…
1
vote
0 answers

What is the correct way to delete a post in within a graphql subscription?

I'm working on a project where I have posts that are created and shown on a screen. I've done this using graphql subscriptions for real time updating of posts, but I need the user to also be able to delete their own posts and for that update to be…
pelotador.1
  • 195
  • 1
  • 12
1
vote
1 answer

Spring Boot, reactive streams hot publisher and GraphQL subscriptions. Doesn't work as expected

I'm using spring boot v3.0.2 with websockets and faced problem with graphQL subscriptions. The task is pretty simple - notify client when backend entity changes. So, I have EntityChangeNotifier - @Service public class EntityChangeNotifier { …