DEV Community

Discussion on: GraphQL subscriptions with Nest: how to publish across multiple running servers

Collapse
 
dcsan profile image
dc

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?

Collapse
 
rychkog profile image
Georgii Rychko

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 PubSubEngine interface. Here is, for instance, Redis subscription implementation: github.com/davidyaha/graphql-redis...