Has ANYONE successfully set up subscriptions using...
# orm-help
s
Has ANYONE successfully set up subscriptions using Apollo Server and Prisma subscriptions?
I have a private repo I will give anyone access to who would like to help me figure this out… I’m surprised I can’t find anything on the interwebs on how to do this, you’d think someone in the universe has linked these two important GraphQL libraries before
j
Doesn't Apollo Server have its own pub sub?
s
Yes it does, but I want to use prisma’s subscription engine. Looking at this example, there is no use of any of the graphql-subscriptions PubSub’s https://github.com/prisma/prisma-examples/blob/master/typescript/graphql-subscriptions/src/index.ts
j
I don't think prisma has a separate library just for the subscriptions. Prisma is way different than Apollo Server. Prisma is a database abstraction layer, graphql yoga is the server you build to call prisma with.
Nevermind, I found the graphql-subscriptions library, no thanks to google. https://github.com/apollographql/graphql-subscriptions Let me look at the project a bit more.
After looking at the project, I would implement my own microservice for the graphql-subscriptions pubsub, allowing you to write code in your resolvers to publish to the pubsub. Personally, i would use redis if you have to implement this from scratch. It has channels, which is a pretty awesome feature. Plus the caching ability is pretty wicked.
s
Thanks for looking into it, I pushed past my issue. Once I get it working fully I might make the repo public and share.