title: NestJS GraphQL subscriptions not working with `graphql-ws`
body: <p>I'm trying to upgrade our NestJS GraphQL subscriptions server to utilize <code>graphql-ws</code> rather than the current <code>subscriptions-transport-ws</code> (as suggested by the <a href="https://docs.nestjs.com/graphql/subscriptions" rel="noreferrer">NestJS documentation</a>).
  I upgraded the NestJS version to</p>
  <pre><code>    &quot;@nestjs/core&quot;: &quot;^8.0.6&quot;,
      &quot;@nestjs/graphql&quot;: &quot;^9.0.4&quot;,
      &quot;@nestjs/platform-express&quot;: &quot;^8.0.6&quot;,
      &quot;graphql&quot;: &quot;^15.5.3&quot;,
      &quot;graphql-tools&quot;: &quot;^8.2.0&quot;,
      &quot;apollo-server-express&quot;: &quot;^3.3.0&quot;,
  </code></pre>
  <p>And after, I added the <code>subscriptions</code> option to the <code>App.Module</code>:</p>
  <pre><code>    GraphQLModule.forRoot({
        autoSchemaFile: true,
        sortSchema: true,
        playground: true,
        installSubscriptionHandlers: true,
        subscriptions: {
          'graphql-ws': true
        },
      }),
  </code></pre>
  <p>However when I subscribe (in playground) to a previously working subscription, I get:</p>
  <pre><code>{
    &quot;error&quot;: &quot;Could not connect to websocket endpoint ws://localhost:8880/graphql. Please check if the endpoint url is correct.&quot;
  }
  </code></pre>
  <p>And in the console I get:</p>
  <pre><code>WebSocket protocol error occured. It was most likely caused due to an unsupported subprotocol &quot;graphql-ws&quot; requested by the client. graphql-ws implements exclusively the &quot;graphql-transport-ws&quot; subprotocol, please make sure that the client implements it too.
  </code></pre>
  <p>Things I have tried:</p>
  <ul>
  <li>Adding the <code>graphql-ws</code> package</li>
  <li>Upgrading the NestJS version again</li>
  <li>Removing the <code>installSubscriptionHandlers</code> option from config</li>
  <li>Setting <code>graphql-ws</code> configs instead of passing <code>true</code></li>
  <li>Using the <code>WebSocket Test Client</code> Google Chrome extension instead of Playground</li>
  </ul>
  <p>But none have worked. Sorry for the long post. How can I fix this?</p>