using Apollo server: 1. server.js const { ApolloServer , gql , AuthenticationError , PubSub } = require ( 'apollo-server' ) const pubsub = new PubSub () const server = new ApolloServer ({ typeDefs , resolvers , formatError : error => { console . log ( JSON . stringify ( error )) return { ... error } }, introspection: true , playground: true , context : async ({ req , connection }) => { if ( connection ) { return { pubsub } } if ( req ) { const me = await getMe ( req ) return { me , secret: process . env . SECRET , pubsub } } } }) 2. schema: project.js extend type Subscription { projectAdded: Project } 3. resolver: project.js const PROJECT_CHANNEL = 'PROJECT_CHANNEL' Mutation: { addProject: combineResolvers ( isAuthenticated , async ( parent , { projectInput }, { models , me , pubsub }) => { ...