graphql-subscriptions

  • Version 3.0.0
  • Published
  • 61 kB
  • No dependencies
  • MIT license

Install

npm i graphql-subscriptions
yarn add graphql-subscriptions
pnpm add graphql-subscriptions

Overview

GraphQL subscriptions for node.js

Index

Functions

function withFilter

withFilter: <TSource = any, TArgs = any, TContext = any>(
asyncIteratorFn: ResolverFn<TSource, TArgs, TContext>,
filterFn: FilterFn<TSource, TArgs, TContext>
) => IterableResolverFn<TSource, TArgs, TContext>;

    Classes

    class PubSub

    class PubSub<
    Events extends {
    [event: string]: unknown;
    } = Record<string, never>
    > extends PubSubEngine {}

      constructor

      constructor(options?: PubSubOptions);

        property ee

        protected ee: EventEmitter;

          method publish

          publish: <K extends keyof Events>(
          triggerName: K & string,
          payload: Events[K] extends never ? any : Events[K]
          ) => Promise<void>;

            method subscribe

            subscribe: <K extends keyof Events>(
            triggerName: K & string,
            onMessage: (...args: any[]) => void
            ) => Promise<number>;

              method unsubscribe

              unsubscribe: (subId: number) => void;

                class PubSubEngine

                abstract class PubSubEngine {}

                  method asyncIterableIterator

                  asyncIterableIterator: <T>(
                  triggers: string | readonly string[]
                  ) => PubSubAsyncIterableIterator<T>;

                    method publish

                    abstract publish: (triggerName: string, payload: any) => Promise<void>;

                      method subscribe

                      abstract subscribe: (
                      triggerName: string,
                      onMessage: Function,
                      options: Object
                      ) => Promise<number>;

                        method unsubscribe

                        abstract unsubscribe: (subId: number) => any;

                          Interfaces

                          interface PubSubOptions

                          interface PubSubOptions {}

                            property eventEmitter

                            eventEmitter?: EventEmitter;

                              Type Aliases

                              type FilterFn

                              type FilterFn<TSource = any, TArgs = any, TContext = any> = (
                              rootValue?: TSource,
                              args?: TArgs,
                              context?: TContext,
                              info?: any
                              ) => boolean | Promise<boolean>;

                                type IterableResolverFn

                                type IterableResolverFn<TSource = any, TArgs = any, TContext = any> = (
                                rootValue?: TSource,
                                args?: TArgs,
                                context?: TContext,
                                info?: any
                                ) => AsyncIterableIterator<any> | Promise<AsyncIterableIterator<any>>;

                                  type ResolverFn

                                  type ResolverFn<TSource = any, TArgs = any, TContext = any> = (
                                  rootValue?: TSource,
                                  args?: TArgs,
                                  context?: TContext,
                                  info?: any
                                  ) => AsyncIterator<any> | Promise<AsyncIterator<any>>;

                                    Package Files (4)

                                    Dependencies (0)

                                    No dependencies.

                                    Dev Dependencies (17)

                                    Peer Dependencies (1)

                                    Badge

                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/graphql-subscriptions.

                                    • Markdown
                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/graphql-subscriptions)
                                    • HTML
                                      <a href="https://www.jsdocs.io/package/graphql-subscriptions"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>