
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
graphql-postgres-subscriptions
Advanced tools
[](https://travis-ci.org/GraphQLCollege/graphql-postgres-subscriptions)
A graphql subscriptions implementation using postgres and apollo's graphql-subscriptions.
This package implements the PubSubEngine Interface from the graphql-subscriptions package and also the new AsyncIterator interface. It allows you to connect your subscriptions manger to a postgres based Pub Sub mechanism to support multiple subscription manager instances.
yarn add graphql-postgres-subscriptions
or npm install graphql-postgres-subscriptions --save
Follow the instructions in graphql-subscriptions.
Replace PubSub
with PostgresPubSub
:
// Before
import { PubSub } from 'graphql-subscriptions';
export const pubsub = new PubSub();
// After
import { PostgresPubSub } from 'graphql-postgres-subscriptions';
export const pubsub = new PostgresPubSub();
This library uses node-postgres
to connect to PostgreSQL. If you want to customize connection options, please refer to their connection docs.
You have three options:
If you don's send any argument to new PostgresPubSub()
, we'll create a postgres
client with no arguments.
You can also pass node-postgres connection options to PostgresPubSub
.
You can instantiate your own client
and pass it to PostgresPubSub
. Like this:
import { PostgresPubSub } from 'graphql-postgres-subscriptions';
import { Client } from "pg";
const client = new Client();
await client.connect();
const pubsub = new PostgresPubSub({ client });
Important: Don't pass clients from pg
's Pool
to PostgresPubSub
. As node-postgres creator states in this StackOverflow answer, the client needs to be around and not shared so pg can properly handle NOTIFY
messages (which this library uses under the hood)
This project has an integration test suite that uses jest
to make sure everything works correctly.
We use Docker to spin up a PostgreSQL instance before running the tests. To run them, type the following commands:
docker-compose build
docker-compose run test
FAQs
[](https://travis-ci.org/GraphQLCollege/graphql-postgres-subscriptions)
The npm package graphql-postgres-subscriptions receives a total of 1,676 weekly downloads. As such, graphql-postgres-subscriptions popularity was classified as popular.
We found that graphql-postgres-subscriptions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.