0.1.0 • Published 3 years ago

graphql-pg-listen-subscriptions v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

graphql-pg-listen-subscriptions

This package implements the PubSubEngine Interface from the graphql-subscriptions package.

Why

I've tried a package to implement pg pubsub and GraphQL subscriptions, but it no longer works.

Install

yarn add graphql-pg-listen-subscriptions

Getting Started

import { PgPubsub } from 'graphql-pg-listen-subscriptions'

export const pubsub = new PgPubsub('postgres://user:pass@127.0.0.1/my-db')

Now, implement your Subscriptions type resolver, using the pubsub.asyncIterator to map the event you need:

const SOMETHING_CHANGED_TOPIC = 'something_changed'

export const resolvers = {
  Subscription: {
    somethingChanged: {
      subscribe: () => pubsub.asyncIterator(SOMETHING_CHANGED_TOPIC),
    },
  },
}
0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago