Today we'll learn how to setup GraphQL (GQL) subscriptions using Redis and NestJS.
Prerequisites for this article:
An experience in GraphQL
So...
For further actions, you may consider blocking this person and/or reporting abuse
Hello Georgii Rychko, I followed your tutorial to learn about graphql subscriptions and at the end i had the same code you have here without the part multiple ports. But Graphql allways throws an error when i want to subscribe on port 3000 (my app also runs on 30) with:
{
"error": {
"message": "Cannot read property 'headers' of undefined"
}
}
Do you have an idea why? Thank you. Great Tutorial!
Does postgres backed pub/sub also provide this type of event driven data sync? I thought postgres itself has emitter type functionality so the graphql code layer would then need to use sockets for communication?
The Pub/Sub that is available in PostgreSQL would also work but you might create an extra load on the db server by making it responsible for doing regular data manipulation stuff + pub/sub.
In general you're right and in order to start using PostgreSQL as a pub/sub engine one need to implement Apollo's
PubSubEngineinterface. Here is, for instance, Redis subscription implementation: github.com/davidyaha/graphql-redis...Thanks for the detailed explanation. Original docs are not precise & clear enough.
Great post, this is exactly what I was looking for.
Do you know how can I listen to these Subscriptions on a Reactjs app?
I think it could be helpful. Awesome lib: apollographql.com/docs/react
Great post! Thank you!
Great post
Thanks!