subscriptions-transport-ws

  • Version 0.11.0
  • Published
  • 270 kB
  • 5 dependencies
  • MIT license

Install

npm i subscriptions-transport-ws
yarn add subscriptions-transport-ws
pnpm add subscriptions-transport-ws

Overview

A websocket transport for GraphQL subscriptions

Index

Variables

variable GRAPHQL_SUBSCRIPTIONS

const GRAPHQL_SUBSCRIPTIONS: string;

    variable GRAPHQL_WS

    const GRAPHQL_WS: string;

      Classes

      class MessageTypes

      class MessageTypes {}

        constructor

        constructor();

          property GQL_COMPLETE

          static GQL_COMPLETE: string;

            property GQL_CONNECTION_ACK

            static GQL_CONNECTION_ACK: string;

              property GQL_CONNECTION_ERROR

              static GQL_CONNECTION_ERROR: string;

                property GQL_CONNECTION_INIT

                static GQL_CONNECTION_INIT: string;

                  property GQL_CONNECTION_KEEP_ALIVE

                  static GQL_CONNECTION_KEEP_ALIVE: string;

                    property GQL_CONNECTION_TERMINATE

                    static GQL_CONNECTION_TERMINATE: string;

                      property GQL_DATA

                      static GQL_DATA: string;

                        property GQL_ERROR

                        static GQL_ERROR: string;

                          property GQL_START

                          static GQL_START: string;

                            property GQL_STOP

                            static GQL_STOP: string;

                              property INIT

                              static INIT: string;

                                property INIT_FAIL

                                static INIT_FAIL: string;

                                  property INIT_SUCCESS

                                  static INIT_SUCCESS: string;

                                    property KEEP_ALIVE

                                    static KEEP_ALIVE: string;

                                      property SUBSCRIPTION_DATA

                                      static SUBSCRIPTION_DATA: string;

                                        property SUBSCRIPTION_END

                                        static SUBSCRIPTION_END: string;

                                          property SUBSCRIPTION_FAIL

                                          static SUBSCRIPTION_FAIL: string;

                                            property SUBSCRIPTION_START

                                            static SUBSCRIPTION_START: string;

                                              property SUBSCRIPTION_SUCCESS

                                              static SUBSCRIPTION_SUCCESS: string;

                                                class SubscriptionClient

                                                class SubscriptionClient {}

                                                  constructor

                                                  constructor(
                                                  url: string,
                                                  options?: ClientOptions,
                                                  webSocketImpl?: any,
                                                  webSocketProtocols?: string | string[]
                                                  );

                                                    property client

                                                    client: any;

                                                      property operations

                                                      operations: Operations;

                                                        property status

                                                        readonly status: any;

                                                          method applyMiddlewares

                                                          applyMiddlewares: (options: OperationOptions) => Promise<OperationOptions>;

                                                            method close

                                                            close: (isForced?: boolean, closedByUser?: boolean) => void;

                                                              method on

                                                              on: (eventName: string, callback: ListenerFn, context?: any) => Function;

                                                                method onConnected

                                                                onConnected: (callback: ListenerFn, context?: any) => Function;

                                                                  method onConnecting

                                                                  onConnecting: (callback: ListenerFn, context?: any) => Function;

                                                                    method onDisconnected

                                                                    onDisconnected: (callback: ListenerFn, context?: any) => Function;

                                                                      method onError

                                                                      onError: (callback: ListenerFn, context?: any) => Function;

                                                                        method onReconnected

                                                                        onReconnected: (callback: ListenerFn, context?: any) => Function;

                                                                          method onReconnecting

                                                                          onReconnecting: (callback: ListenerFn, context?: any) => Function;

                                                                            method request

                                                                            request: (request: OperationOptions) => Observable<ExecutionResult>;

                                                                              method unsubscribeAll

                                                                              unsubscribeAll: () => void;

                                                                                method use

                                                                                use: (middlewares: Middleware[]) => SubscriptionClient;

                                                                                  class SubscriptionServer

                                                                                  class SubscriptionServer {}

                                                                                    constructor

                                                                                    constructor(options: ServerOptions, socketOptionsOrServer: any);

                                                                                      property server

                                                                                      readonly server: WebSocket.Server;

                                                                                        method close

                                                                                        close: () => void;

                                                                                          method create

                                                                                          static create: (
                                                                                          options: ServerOptions,
                                                                                          socketOptionsOrServer: WebSocket.ServerOptions | WebSocket.Server
                                                                                          ) => SubscriptionServer;

                                                                                            Interfaces

                                                                                            interface ClientOptions

                                                                                            interface ClientOptions {}

                                                                                              property connectionCallback

                                                                                              connectionCallback?: (error: Error[], result?: any) => void;

                                                                                                property connectionParams

                                                                                                connectionParams?: ConnectionParamsOptions;

                                                                                                  property inactivityTimeout

                                                                                                  inactivityTimeout?: number;

                                                                                                    property lazy

                                                                                                    lazy?: boolean;

                                                                                                      property minTimeout

                                                                                                      minTimeout?: number;

                                                                                                        property reconnect

                                                                                                        reconnect?: boolean;

                                                                                                          property reconnectionAttempts

                                                                                                          reconnectionAttempts?: number;

                                                                                                            property timeout

                                                                                                            timeout?: number;

                                                                                                              property wsOptionArguments

                                                                                                              wsOptionArguments?: any[];

                                                                                                                interface ExecutionParams

                                                                                                                interface ExecutionParams<TContext = any> {}

                                                                                                                  property callback

                                                                                                                  callback?: Function;

                                                                                                                    property context

                                                                                                                    context: TContext;

                                                                                                                      property formatError

                                                                                                                      formatError?: Function;

                                                                                                                        property formatResponse

                                                                                                                        formatResponse?: Function;

                                                                                                                          property operationName

                                                                                                                          operationName: string;

                                                                                                                            property query

                                                                                                                            query: string | DocumentNode;

                                                                                                                              property schema

                                                                                                                              schema?: GraphQLSchema;

                                                                                                                                property variables

                                                                                                                                variables: {
                                                                                                                                [key: string]: any;
                                                                                                                                };

                                                                                                                                  interface Middleware

                                                                                                                                  interface Middleware {}

                                                                                                                                    method applyMiddleware

                                                                                                                                    applyMiddleware: (options: OperationOptions, next: Function) => void;

                                                                                                                                      interface Observable

                                                                                                                                      interface Observable<T> {}

                                                                                                                                        method subscribe

                                                                                                                                        subscribe: (observer: Observer<T>) => { unsubscribe: () => void };

                                                                                                                                          interface Observer

                                                                                                                                          interface Observer<T> {}

                                                                                                                                            property complete

                                                                                                                                            complete?: () => void;

                                                                                                                                              property error

                                                                                                                                              error?: (error: Error) => void;

                                                                                                                                                property next

                                                                                                                                                next?: (value: T) => void;

                                                                                                                                                  interface Operation

                                                                                                                                                  interface Operation {}

                                                                                                                                                    property handler

                                                                                                                                                    handler: (error: Error[], result?: any) => void;

                                                                                                                                                      property options

                                                                                                                                                      options: OperationOptions;

                                                                                                                                                        interface OperationMessage

                                                                                                                                                        interface OperationMessage {}

                                                                                                                                                          property id

                                                                                                                                                          id?: string;

                                                                                                                                                            property payload

                                                                                                                                                            payload?: OperationMessagePayload;

                                                                                                                                                              property type

                                                                                                                                                              type: string;

                                                                                                                                                                interface OperationMessagePayload

                                                                                                                                                                interface OperationMessagePayload {}

                                                                                                                                                                  property operationName

                                                                                                                                                                  operationName?: string;

                                                                                                                                                                    property query

                                                                                                                                                                    query?: string;

                                                                                                                                                                      property variables

                                                                                                                                                                      variables?: {
                                                                                                                                                                      [key: string]: any;
                                                                                                                                                                      };

                                                                                                                                                                        index signature

                                                                                                                                                                        [key: string]: any;

                                                                                                                                                                          interface OperationOptions

                                                                                                                                                                          interface OperationOptions {}

                                                                                                                                                                            property operationName

                                                                                                                                                                            operationName?: string;

                                                                                                                                                                              property query

                                                                                                                                                                              query?: string | DocumentNode;

                                                                                                                                                                                property variables

                                                                                                                                                                                variables?: Object;

                                                                                                                                                                                  index signature

                                                                                                                                                                                  [key: string]: any;

                                                                                                                                                                                    interface Operations

                                                                                                                                                                                    interface Operations {}

                                                                                                                                                                                      index signature

                                                                                                                                                                                      [id: string]: Operation;

                                                                                                                                                                                        interface ServerOptions

                                                                                                                                                                                        interface ServerOptions {}

                                                                                                                                                                                          property execute

                                                                                                                                                                                          execute?: ExecuteFunction;

                                                                                                                                                                                            property keepAlive

                                                                                                                                                                                            keepAlive?: number;

                                                                                                                                                                                              property onConnect

                                                                                                                                                                                              onConnect?: Function;

                                                                                                                                                                                                property onDisconnect

                                                                                                                                                                                                onDisconnect?: Function;

                                                                                                                                                                                                  property onOperation

                                                                                                                                                                                                  onOperation?: Function;

                                                                                                                                                                                                    property onOperationComplete

                                                                                                                                                                                                    onOperationComplete?: Function;

                                                                                                                                                                                                      property rootValue

                                                                                                                                                                                                      rootValue?: any;

                                                                                                                                                                                                        property schema

                                                                                                                                                                                                        schema?: GraphQLSchema;

                                                                                                                                                                                                          property subscribe

                                                                                                                                                                                                          subscribe?: SubscribeFunction;

                                                                                                                                                                                                            property validationRules

                                                                                                                                                                                                            validationRules?:
                                                                                                                                                                                                            | Array<(context: ValidationContext) => any>
                                                                                                                                                                                                            | ReadonlyArray<any>;

                                                                                                                                                                                                              Type Aliases

                                                                                                                                                                                                              type ConnectionContext

                                                                                                                                                                                                              type ConnectionContext = {
                                                                                                                                                                                                              initPromise?: Promise<any>;
                                                                                                                                                                                                              isLegacy: boolean;
                                                                                                                                                                                                              socket: WebSocket;
                                                                                                                                                                                                              request: IncomingMessage;
                                                                                                                                                                                                              operations: {
                                                                                                                                                                                                              [opId: string]: ExecutionIterator;
                                                                                                                                                                                                              };
                                                                                                                                                                                                              };

                                                                                                                                                                                                                type ConnectionParams

                                                                                                                                                                                                                type ConnectionParams = {
                                                                                                                                                                                                                [paramName: string]: any;
                                                                                                                                                                                                                };

                                                                                                                                                                                                                  type ConnectionParamsOptions

                                                                                                                                                                                                                  type ConnectionParamsOptions =
                                                                                                                                                                                                                  | ConnectionParams
                                                                                                                                                                                                                  | Function
                                                                                                                                                                                                                  | Promise<ConnectionParams>;

                                                                                                                                                                                                                    type ExecuteFunction

                                                                                                                                                                                                                    type ExecuteFunction = (
                                                                                                                                                                                                                    args: ExecutionArgs
                                                                                                                                                                                                                    ) => ExecutionResult | Promise<ExecutionResult> | AsyncIterator<ExecutionResult>;

                                                                                                                                                                                                                      type ExecutionIterator

                                                                                                                                                                                                                      type ExecutionIterator = AsyncIterator<ExecutionResult>;

                                                                                                                                                                                                                        type FormatedError

                                                                                                                                                                                                                        type FormatedError = Error & {
                                                                                                                                                                                                                        originalError?: any;
                                                                                                                                                                                                                        };

                                                                                                                                                                                                                          type SubscribeFunction

                                                                                                                                                                                                                          type SubscribeFunction = (
                                                                                                                                                                                                                          args: SubscriptionArgs
                                                                                                                                                                                                                          ) =>
                                                                                                                                                                                                                          | AsyncIterator<ExecutionResult>
                                                                                                                                                                                                                          | Promise<AsyncIterator<ExecutionResult> | ExecutionResult>;

                                                                                                                                                                                                                            Namespaces

                                                                                                                                                                                                                            namespace backo2

                                                                                                                                                                                                                            module 'backo2' {}

                                                                                                                                                                                                                              namespace lodash.assign

                                                                                                                                                                                                                              module 'lodash.assign' {}

                                                                                                                                                                                                                                namespace lodash.isobject

                                                                                                                                                                                                                                module 'lodash.isobject' {}

                                                                                                                                                                                                                                  namespace lodash.isstring

                                                                                                                                                                                                                                  module 'lodash.isstring' {}

                                                                                                                                                                                                                                    Package Files (6)

                                                                                                                                                                                                                                    Dependencies (5)

                                                                                                                                                                                                                                    Dev Dependencies (20)

                                                                                                                                                                                                                                    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/subscriptions-transport-ws.

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