Working getting subscriptions working in apollo. I have my web socket set up properly, and I can see that I'm connecting, as I see it flow into the pubsub module. Though I think something is up with how I subscribing, as the server is not triggering a response when I publish.
Apologize for any confusion around naming, as I'm using it for something called subscriptions.
Graphql Subscription
subscription subscriptionsUpdated($userId: String!){
subscriptionsUpdated(user: $userId, type:ROOM, open:true) {
id,
parent{
... on Rooms{
id
}
}
}
}
GraphQLType
subscription: new GraphQLObjectType({
name: `subscriptions`,
fields: {
subscriptionsUpdated:{
type:Subscriptions.type,
args:{
parent: { type: GraphQLString},
type:{ type: ContentTypes },
open: {type: GraphQLBoolean },
user:{type: GraphQLString },
},
resolve:(source, args)=>{
console.log('it worked and stuff');
return {};
}
},
}
})
Susbscription Manager and setup functions:
import schema from '../graphql/index.js';
const subscriptionManager = new SubscriptionManager({
schema,
pubsub,
setupFunctions: {
subscriptionsUpdated: (options, args) => ({
subscriptionsUpdated: (comment)=>{
return true;
},
}),
},
});
In My Mutation (I can see this firing)
pubsub.publish('subscriptionsUpdated', doc);
With the event firing, shouldn't the subscriptionsUpdated resolve function / or the setup function fire?
I've looked into the githunt examples and medium post on the topic, but still struggling to get this last part working.
Any help or insight would be awesome!