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

WebSocket connection to 'wss://api-such.andsuch.xyz/graphql/' failed: Error during WebSocket handshake: Unexpected response code: 400

I recently deployed a project I'm working on to production. I use DjangoChannelsGraphqlWs for GraphQL subscription functionalities. and I have GraphQL Playground set up via django-graphql-playground. Everything works fine locally - there are no…
2
votes
0 answers

React Component subscription detect GraphQL server not responding

I have a device that sends a heartbeat to my Apollo GraphQL server every 30 seconds. I have a React component that subscribes to hbReceived, and displays the most recent heartbeat time. This works fine. BUT, If my GraphQL server is down, I want to…
NULL pointer
  • 1,116
  • 1
  • 14
  • 27
2
votes
2 answers

Apollo Graphql with Angular with headers and Subscriptions

I need to add headers to my graphql requests with angular with subscriptions. but I didn't find any way. headers will be added if I only used headers without subscriptions. Also, subscriptions will works if I didn't add headers. But with both, it…
Hasitha Chandula
  • 425
  • 4
  • 12
2
votes
0 answers

Apollo graphql subscriptions, using the same endpoint for the graphql server and websocket endpoint

I was just wondering if there was any performance decrease or any disadvantage in using the same endpoint for the graphql endpoint and also for the WebSocket. You can see the sample code below. import express = require("express"); import {…
Mikias Abebe
  • 149
  • 2
  • 6
2
votes
1 answer

internal cross service communication - subscription or other?

I have an architecture question and would love to hear from your experience. in a micro service environment. when 2 graphql API micro services that need to communicate with each other async via some kind of pub-sub mechanism. would you choose a…
gkatz
  • 87
  • 7
2
votes
0 answers

apollo client , adding subscriptions while not breaking http link that uses jwt

I currently have a graphql api that handles HTTP requests, I've migrated to apollo-client and now I want to add subscriptions. The problem is, that I can't figure out how to combine my HTTP link (that has a JWT auth middleware). I have no code…
2
votes
1 answer

How do I use two different websocket url based on context in react-apollo?

I have got a problem. The scenario is we have two graphql servers. I have split them passing context in the query/mutation options. It works but I also have two different websocket setup. As we can split subscription using…
2
votes
0 answers

GraphQL Subscriptions Error: "The \"properties\" argument must be of type Array. Received type object"

I am trying to implement a simple API with GraphQL. My queries and my mutations are in place and working, but now I'm trying to include subscriptions as well. I already added the subscription in the schema, I included the event publish in the…
ggluta
  • 143
  • 1
  • 11
2
votes
1 answer

Raw javascript GraphQL subscription with WebSocket not working

I am trying to create a raw piece of code that listen to a graphQL Subscription but I am not able to make it work for some reasons. I am trying to mimic the raw request sent from the GraphQL console which you can see here it seems pretty simple. So…
cyril94440
  • 1,057
  • 1
  • 9
  • 22
2
votes
1 answer

What is the correct way to connect to a graphql-yoga server via apollo for subscriptions?

apollo-client: 2.6.3 apollo-link-http: 1.5.15 apollo-link-ws: 1.0.18 subscriptions-transport-ws: 0.9.16 So I have a front-end (node) server which connects to a back-end (graphql-yoga) server as follows: const httpLink = createHttpLink({ …
TheoG
  • 1,498
  • 4
  • 30
  • 54
2
votes
0 answers

How can I stop the subscription in GraphQL?

Here's a piece of code I'm interested in (it's taken from /examples/ directory): Subscription: { counter: { subscribe: (parent, args, { pubsub }) => { const channel = Math.random().toString(36).substring(2, 15) // random channel…
A. Karnaval
  • 727
  • 2
  • 8
  • 12
2
votes
0 answers

subscriptionsClient.subscribe is not a function

At this instance i am just trying to run a dummy subscription using graphql-subscriptions, and later-on, integrate it in my code. However, even with the minimal example. I am following a scotch.io example, here is its git…
2
votes
1 answer

How to consume graphql subscriptions with flutter?

I am using the flutter_graphql plugin and it is working fine for queries and mutations but I am facing the problem with subscriptions. Following is the code that I have tried out but it is just printing the loading not even hitting the…
Hardik Modi
  • 312
  • 4
  • 16
2
votes
1 answer

Issue setting up subscription with GraphQL

Good day: I"m trying to setup my graphql server for a subscription. This is my schema.js const ChatCreatedSubscription = new GraphQLObjectType({ name: "ChatCreated", fields: () => ({ chatCreated: { subscribe: () =>…
Dean
  • 887
  • 4
  • 16
  • 42
2
votes
1 answer

AWS Appsync complex subscription arguments

I'm currently working on an messaging app and want to create a global subscription just to demonstrate what I want to achieve Suppose there is a mutation like sendMessage that contains senderId and Members just for example like :- mutation…
tryKuldeepTanwar
  • 3,490
  • 2
  • 19
  • 49