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
31
votes
2 answers

Stitching secure subscriptions using makeRemoteExecutableSchema

We have implemented schema stitching where GraphQL server fetches schema from two remote servers and stitches them together. Everything was working fine when we were only working with Query and Mutations, but now we have a use-case where we even…
16
votes
2 answers

WebSocket connection to 'ws:/_next/webpack-hmr' failed: WebSocket is closed before the connection is established

Hi am having this problem, i try to make subscriptions with graphql in nextjs, but something is wrong and i dont have any idea how fix it. I am having websocket error - "WebSocket connection to 'ws:/_next/webpack-hmr' failed: WebSocket is closed…
15
votes
3 answers

GraphQL Subscriptions: Max Listeners Exceeded Warning

We are using GraphQL Subscriptions and pubsub to subscribe to posts. When more than 10 subscriptions occur we get the the node warning "MaxListenersExceededWarning: Possible EventEmitter memory leak detected." Is it possible to raise the max…
Locco0_0
  • 3,420
  • 5
  • 30
  • 42
11
votes
2 answers

NestJS GraphQL subscriptions not working with `graphql-ws`

I'm trying to upgrade our NestJS GraphQL subscriptions server to utilize graphql-ws rather than the current subscriptions-transport-ws (as suggested by the NestJS documentation). I upgraded the NestJS version to "@nestjs/core": "^8.0.6", …
BehzadV
  • 167
  • 3
  • 10
11
votes
1 answer

What are differences between GraphQL Subscription and WebSocket protocol?

I have two sides. In one side I have direct usage of WebSocket protocol by using libraries/packages like ws (a Node.js WebSocket library) or Socket.io. Here I can use test tools to subscribe against and address starting with ws or wss like…
Afshar Mohebi
  • 10,479
  • 17
  • 82
  • 126
11
votes
2 answers

Subscription not connecting using ApolloServer

I am trying to get a subscription up and running with ApolloServer (v 2.2.2). I had a setup that all-of-a-sudden just stopped working. When I try to connect to the subscription in graphiql/PlaygroundI get the error: { "error": "Could not connect…
Max Gordon
  • 5,367
  • 2
  • 44
  • 70
10
votes
0 answers

How to trigger GraphQL Subscriptions from a backend message queue application

Currently I'm using Socket.io / SignalR to emit an event from my backend message queue system, whenever new data is incoming. That way I can setup an event handler in my React application and update the relay cache from within the event handler. It…
Dac0d3r
  • 2,176
  • 6
  • 40
  • 76
10
votes
3 answers

Serverless GraphQL Subscriptions

I recently started working with GraphQL and have been able to successful set it up on AWS Lambda giving me a "serverless" architecture. However I would like to utilize GraphQL Subscriptions for more realtime functionality. I understand that AWS…
8
votes
3 answers

GraphQL Subscriptions vs socket.io

I'm trying to make real-time application based on websocket and got two options. One is socket.io and the other is GraphQL Subscriptions. But it was hard to find comparison of those. What can be standard to choose one of them and is there any…
lcpnine
  • 477
  • 1
  • 7
  • 16
8
votes
2 answers

GraphQL: How nested to make schema?

This past year I converted an application to use Graphql. Its been great so far, during the conversion I essentially ported all my services that backed my REST endpoints to back grapqhl queries and mutations. The app is working well but would like…
sauce
  • 592
  • 4
  • 9
  • 25
8
votes
1 answer

AWS AppSync Authorization

I'm planning to use AWS Appsync to migrate a graphQL endpoint in a lambda function, which is being triggered by a POST via the API Gateway. I'm looking into AppSync mainly because of the subscriptions, which I can't create using a Lambda…
8
votes
1 answer

Uncaught TypeError: Can't add property 12, object is not extensible

I can't seem to understand the error I am getting on my client application. I am subscribing to a graphql subscription and I am able to retrieve the updates but I am not being able to push the changes to the typescript array called…
7
votes
3 answers

Apollo Server with subscriptions used inside next.js api routes: websockets trouble

i try to setup GraphQL Subscriptions inside a next.js 9.x app. The app is totally fake, it is just for trying Apollo Server subscriptions. The "database" is just an array, where I push new users to it. This is the code I got so far. import {…
7
votes
1 answer

How to use GraphQL subscription correctly?

I have a GraphQL powered app. The query and mutation parts work well. I try to add GraphQL subscription. The server GraphQL subscription part code is inspired by the demo in the readme of apollographql/subscriptions-transport-ws. Please also check…
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267
6
votes
2 answers

How to detect disconnect and reconnect for subscription(websocket) in apollo client

I am building a chat service and I want to handle the cases when the subscription(websocket) connection is disconnected. Apollo client is configured like bellow. I removed unnecessary code like cache, authLink etc. How do I do this with react,…
Sihoon Kim
  • 1,481
  • 2
  • 13
  • 32
1
2 3
18 19