title: How to trigger subscriptions in type-graphql?
body: <p>I have a project set up with Apollo Server with express. I have been trying to set up subscriptions but it is just not happening. I have followed all the steps as per the following link :</p>
  <p><a href="https://typegraphql.com/docs/subscriptions.html" rel="nofollow noreferrer">https://typegraphql.com/docs/subscriptions.html</a></p>
  <p>Further, I wasn't able to listen when I ran my subscription initially. So I wrapped my express app with an http server and in my app.listen, I added a new subscription server and then the subscription was listening. But now , when I run the mutation that is supposed to trigger the subscription, it doesn't get triggered. I have been trying a bunch of things and nothing on SO or Github has helped me so far.</p>
  <p>The following is the code of the server</p>
  <pre><code>
  import express from &quot;express&quot;;
  import { ApolloServer } from &quot;apollo-server-express&quot;;
  import cors from &quot;cors&quot;;
  import { SubscriptionServer } from &quot;subscriptions-transport-ws&quot;;
  import { execute, subscribe } from &quot;graphql&quot;;
  import { createServer } from &quot;http&quot;;
  
  const main = () =&gt; {
    const app = express();
  
    app.use(
      cors({
        origin: &quot;http://localhost:3000&quot;,
        credentials: true,
      })
    );
    const apolloServer = new ApolloServer({
      playground: {
        settings: {
          &quot;request.credentials&quot;: &quot;include&quot;,
        },
      },
      schema: await buildSchema({
        resolvers: [Resolver1, Resolver2, Resolver3],
        validate: false,
      }),
      context: ({ req, res }) =&gt; ({ req, res, redis }),
    });
  
    apolloServer.applyMiddleware({
      app,
      cors: false,
    });
  
    const server = createServer(app);
  
    server.listen(4000, async () =&gt; {
      console.log(&quot;Server running on port 4000&quot;);
      new SubscriptionServer(
        {
          execute,
          subscribe,
          schema: await buildSchema({
            resolvers: [Resolver1, Resolver2, Resolver3],
            validate: false,
          }),
        },
        {
          server,
          path: &quot;/graphql&quot;,
        }
      );
    });
  };
  </code></pre>
  <p>Please let me know if I'm doing anything wrong or guide me in the right direction.</p>