Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nexus-plugin-subscriptions

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nexus-plugin-subscriptions

A Nexus framework plugin

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

nexus-plugin-subscriptions

Contents

  • Installation
  • Example Usage
  • Runtime Contributions

Installation

npm install nexus-plugin-subscriptions

Example Usage

// app.ts

import { use, server, log } from 'nexus';
import { PrismaClient } from 'nexus-plugin-prisma/client';
import { subscriptions } from 'nexus-plugin-subscriptions';
// Your context handler
import { createContext } from './context';

const db = new PrismaClient();

// Nexus plugins
use(
  subscriptions({
    ws: { server: server.raw.http, path: '/subscriptions' },
    keepAlive: 10 * 1000,
    onConnect: async (payload: Record<string, any>) => {
      log.info('client connected');
      return await createContext(payload['authorization'], { db });
    },
    onDisconnect: () => {
      log.info('client disconnected');
    },
  })
);

Runtime Contributions

Provides your generated schema to nexus-plugin-subscriptions

FAQs

Package last updated on 30 Jul 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc