I just can't get my head around this issue. I read through the docs of @nestjs/graphql, and even checked type-graphql for comparison.
I have this Subscription that I need to get access to request's cookie in it, therefore I pass the request as context in the 'app.module' like this:
@Module({
imports: [
GraphQLModule.forRoot<ApolloDriverConfig>({
driver: ApolloDriver,
playground: true,
installSubscriptionHandlers: true,
autoSchemaFile,
context: ({ req, res }) => ({req, res}),
}),
// ... other modules,
],
providers: [PrismaService]
})
@Subscription(() => ResponseObjectType, {
resolve: function (_, __, context) {
condole.log(context) // gives undefined
// here I need access to the Request object
// return some response
}
})
subscribeHere(@Context() ctx) {
return this.pubsub.asyncIterator('subscribeHere')
}
})
Also I publish to the subscription just as shown in the docs. Help will be really appreciated.