Integration tests for graphql subscribers

How can I pass the publish / subscribe testing of my graphql schema without using apollo?

Can I just do this with subscriptions-transport-ws? My SubscriptionServer is configured with default settings, I can see the publishing going by simply calling a mutation request with graphql. I have established a connection to the website using my express server

const WebSocket = require('ws');
const myServer = require('../../bin/www');
const wsServer = new WebSocket.Server({
  server: myServer
});

const client = new SubscriptionClient(`ws://localhost:3000/subscriptions`, {}, WebSocket);

client.subscribe(
  {
    query: `subscription roomSubscription(placeId: "someid") {
        user {
            id,
            name
        }
    }`,
  },
  (error, result) => {
      console.log({error, result});
  }
);


const query = `
    mutation { 
        roomAddOrUpdate(placeId: "some id") {
            user {
                name
            }
        }
    }`;
   const result = await graphql(schema, query, {}, req); 

      

nothing seems to be comforting about the client.subscribe function, not sure if I will go this correct path. You can see my setup here https://github.com/farzd/firstsight/blob/master/bin/www

+3
graphql


source to share


No one has answered this question yet

Check out similar questions:

2
Apollo subscription not working
2
Unrecognized arguments in graphql mutation
1
GraphQL Subscriptions with Express-GraphQL and React-Apollo
1
Updating authorization header in websocket graphql
1
Apollo GraphQL Subscriptions
0
How can I "spoof" some GraphQL queries while forwarding the rest to an existing GraphQL server?
0
Fire QraphQl subscriber multiple times in one change
0
You need to find an error when connecting a subscription with the firmware of the circuit
0
GraphQL / Sequelize: SQL alias
0
How do I write a recognizer for GraphQL subscription using graphql-java and graphql-java-servlet?



All Articles
Loading...
X
Show
Funny
Dev
Pics