Apollo Subscription - Meteor

Hi,

I would like to make a subscription with GraphQl/Apollo.

I set up my server:

import { createApolloServer } from 'meteor/apollo';
import { WebApp } from 'meteor/webapp';
import { execute, subscribe } from 'graphql';
import { SubscriptionServer } from 'subscriptions-transport-ws';
import OpticsAgent from 'optics-agent';
import { makeExecutableSchema } from 'graphql-tools';
import { typeDefs, resolvers } from '/imports/api/MergeAndCompile.js';
import '/imports/startup/server/index.js';

const schema = makeExecutableSchema({
  typeDefs,
  resolvers,
});

OpticsAgent.instrumentSchema(schema);
createApolloServer(req => ({
  schema,
  context: {
    opticsContext: OpticsAgent.context(req),
  },
}), {
  configServer: (graphQLServer) => {
    graphQLServer.use('/graphql', OpticsAgent.middleware());
  },
});

new SubscriptionServer({
  schema,
  execute,
  subscribe,
}, {
  server: WebApp.httpServer,
  path: '/graphql',
});

and Client:

const GRAPHQL_ENDPOINT = 'ws://localhost:3000/graphql';
const clientSub = new SubscriptionClient(GRAPHQL_ENDPOINT, {
  reconnect: true,
});
const client = new ApolloClient({ networkInterface: clientSub });

Question is how should my subscription resolvers look like?
Right now I’m getting error:

Subscription must return Async Iterable

My resolver looks like:

  Query: {
    getAllNotify: () => MongoNotify.find().fetch(),
  },
  Subscription: {
    notifySubscription: {
      subscribe: () => {
        console.log('??');
      },
    },
  },

NVM,
I decide to create separate server using this awesome app: https://github.com/tmeasday/create-graphql-server
Thanks @tmeasday :slight_smile: