@aws-amplify/pubsub

  • Version 5.0.5
  • Published
  • 487 kB
  • 8 dependencies
  • Apache-2.0 license

Install

npm i @aws-amplify/pubsub
yarn add @aws-amplify/pubsub
pnpm add @aws-amplify/pubsub

Overview

Pubsub category of aws-amplify

Index

Variables

variable CONNECTION_STATE_CHANGE

const CONNECTION_STATE_CHANGE: string;

    variable PubSub

    const PubSub: PubSubClass;

      Functions

      function mqttTopicMatch

      mqttTopicMatch: (filter: string, topic: string) => boolean;

        Classes

        class AbstractPubSubProvider

        abstract class AbstractPubSubProvider implements PubSubProvider {}

          constructor

          constructor(options?: ProviderOptions);

            property options

            readonly options: ProviderOptions;

              method configure

              configure: (config?: ProviderOptions) => ProviderOptions;

                method getCategory

                getCategory: () => string;

                  method getProviderName

                  abstract getProviderName: () => string;

                    method newClient

                    abstract newClient: (clientOptions: ProviderOptions) => Promise<any>;

                      method publish

                      abstract publish: (
                      topics: string[] | string,
                      msg: any,
                      options?: ProviderOptions
                      ) => void;

                        method subscribe

                        abstract subscribe: (
                        topics: string[] | string,
                        options?: ProviderOptions
                        ) => Observable<any>;

                          class AWSAppSyncProvider

                          class AWSAppSyncProvider extends MqttOverWSProvider {}
                          • Deprecated

                            Unused, all usecases have migrated to AWSAppSyncRealtimeProvider

                          property endpoint

                          readonly endpoint: void;

                            method disconnect

                            protected disconnect: (clientId: string) => Promise<void>;

                              method getProviderName

                              getProviderName: () => string;

                                method onDisconnect

                                onDisconnect: ({
                                clientId,
                                errorCode,
                                ...args
                                }: {
                                [x: string]: any;
                                clientId: any;
                                errorCode: any;
                                }) => void;

                                  method publish

                                  publish: (topics: string[] | string, msg: any, options?: any) => Promise<void>;

                                    method subscribe

                                    subscribe: (topics: string[] | string, options?: any) => Observable<any>;

                                      class AWSAppSyncRealTimeProvider

                                      class AWSAppSyncRealTimeProvider extends AbstractPubSubProvider {}

                                        constructor

                                        constructor(options?: ProviderOptions);

                                          property isSSLEnabled

                                          readonly isSSLEnabled: boolean;

                                            method close

                                            close: () => void;
                                            • Mark the socket closed and release all active listeners

                                            method getNewWebSocket

                                            getNewWebSocket: (url: any, protocol: any) => WebSocket;

                                              method getProviderName

                                              getProviderName: () => string;

                                                method newClient

                                                newClient: () => Promise<any>;

                                                  method publish

                                                  publish: (
                                                  _topics: string[] | string,
                                                  _msg: any,
                                                  _options?: any
                                                  ) => Promise<void>;

                                                    method subscribe

                                                    subscribe: (
                                                    _topics: string[] | string,
                                                    options?: AWSAppSyncRealTimeProviderOptions
                                                    ) => Observable<any>;

                                                      class AWSIoTProvider

                                                      class AWSIoTProvider extends MqttOverWSProvider {}

                                                        constructor

                                                        constructor(options?: AWSIoTProviderOptions);

                                                          property endpoint

                                                          readonly endpoint: Promise<string>;

                                                            property region

                                                            readonly region: any;

                                                              method getProviderName

                                                              getProviderName: () => string;

                                                                class MqttOverWSProvider

                                                                class MqttOverWSProvider extends AbstractPubSubProvider {}

                                                                  constructor

                                                                  constructor(options?: MqttProviderOptions);

                                                                    property clientId

                                                                    readonly clientId: any;

                                                                      property clientsQueue

                                                                      readonly clientsQueue: ClientsQueue;

                                                                        property endpoint

                                                                        readonly endpoint: any;

                                                                          property isSSLEnabled

                                                                          readonly isSSLEnabled: boolean;

                                                                            method connect

                                                                            protected connect: (
                                                                            clientId: string,
                                                                            options?: MqttProviderOptions
                                                                            ) => Promise<any>;

                                                                              method disconnect

                                                                              protected disconnect: (clientId: string) => Promise<void>;

                                                                                method getProviderName

                                                                                getProviderName: () => string;

                                                                                  method getTopicForValue

                                                                                  protected getTopicForValue: (value: any) => any;

                                                                                    method newClient

                                                                                    newClient: ({ url, clientId }: MqttProviderOptions) => Promise<any>;

                                                                                      method onDisconnect

                                                                                      onDisconnect: ({
                                                                                      clientId,
                                                                                      errorCode,
                                                                                      ...args
                                                                                      }: {
                                                                                      clientId?: string;
                                                                                      errorCode?: number;
                                                                                      }) => void;

                                                                                        method publish

                                                                                        publish: (topics: string[] | string, msg: any) => Promise<void>;

                                                                                          method subscribe

                                                                                          subscribe: (
                                                                                          topics: string[] | string,
                                                                                          options?: MqttProviderOptions
                                                                                          ) => Observable<any>;

                                                                                            Interfaces

                                                                                            interface AWSAppSyncRealTimeProviderOptions

                                                                                            interface AWSAppSyncRealTimeProviderOptions extends ProviderOptions {}

                                                                                              property additionalHeaders

                                                                                              additionalHeaders?: {
                                                                                              [key: string]: string;
                                                                                              };

                                                                                                property apiKey

                                                                                                apiKey?: string;

                                                                                                  property appSyncGraphqlEndpoint

                                                                                                  appSyncGraphqlEndpoint?: string;

                                                                                                    property authenticationType

                                                                                                    authenticationType?: GraphqlAuthModes;

                                                                                                      property graphql_headers

                                                                                                      graphql_headers?: () => {} | (() => Promise<{}>);

                                                                                                        property query

                                                                                                        query?: string;

                                                                                                          property region

                                                                                                          region?: string;

                                                                                                            property variables

                                                                                                            variables?: object;

                                                                                                              interface AWSIoTProviderOptions

                                                                                                              interface AWSIoTProviderOptions extends MqttProviderOptions {}

                                                                                                                property aws_pubsub_endpoint

                                                                                                                aws_pubsub_endpoint?: string;

                                                                                                                  property aws_pubsub_region

                                                                                                                  aws_pubsub_region?: string;

                                                                                                                    interface MqttProviderOptions

                                                                                                                    interface MqttProviderOptions extends ProviderOptions {}

                                                                                                                      property clientId

                                                                                                                      clientId?: string;

                                                                                                                        property url

                                                                                                                        url?: string;

                                                                                                                          Enums

                                                                                                                          enum ConnectionState

                                                                                                                          enum ConnectionState {
                                                                                                                          Connected = 'Connected',
                                                                                                                          ConnectedPendingNetwork = 'ConnectedPendingNetwork',
                                                                                                                          ConnectionDisrupted = 'ConnectionDisrupted',
                                                                                                                          ConnectionDisruptedPendingNetwork = 'ConnectionDisruptedPendingNetwork',
                                                                                                                          Connecting = 'Connecting',
                                                                                                                          ConnectedPendingDisconnect = 'ConnectedPendingDisconnect',
                                                                                                                          Disconnected = 'Disconnected',
                                                                                                                          ConnectedPendingKeepAlive = 'ConnectedPendingKeepAlive',
                                                                                                                          }
                                                                                                                          • {string}

                                                                                                                          member Connected

                                                                                                                          Connected = 'Connected'

                                                                                                                            member ConnectedPendingDisconnect

                                                                                                                            ConnectedPendingDisconnect = 'ConnectedPendingDisconnect'

                                                                                                                              member ConnectedPendingKeepAlive

                                                                                                                              ConnectedPendingKeepAlive = 'ConnectedPendingKeepAlive'

                                                                                                                                member ConnectedPendingNetwork

                                                                                                                                ConnectedPendingNetwork = 'ConnectedPendingNetwork'

                                                                                                                                  member Connecting

                                                                                                                                  Connecting = 'Connecting'

                                                                                                                                    member ConnectionDisrupted

                                                                                                                                    ConnectionDisrupted = 'ConnectionDisrupted'

                                                                                                                                      member ConnectionDisruptedPendingNetwork

                                                                                                                                      ConnectionDisruptedPendingNetwork = 'ConnectionDisruptedPendingNetwork'

                                                                                                                                        member Disconnected

                                                                                                                                        Disconnected = 'Disconnected'

                                                                                                                                          enum CONTROL_MSG

                                                                                                                                          enum CONTROL_MSG {
                                                                                                                                          CONNECTION_CLOSED = 'Connection closed',
                                                                                                                                          CONNECTION_FAILED = 'Connection failed',
                                                                                                                                          REALTIME_SUBSCRIPTION_INIT_ERROR = 'AppSync Realtime subscription init error',
                                                                                                                                          SUBSCRIPTION_ACK = 'Subscription ack',
                                                                                                                                          TIMEOUT_DISCONNECT = 'Timeout disconnect',
                                                                                                                                          }

                                                                                                                                            member CONNECTION_CLOSED

                                                                                                                                            CONNECTION_CLOSED = 'Connection closed'

                                                                                                                                              member CONNECTION_FAILED

                                                                                                                                              CONNECTION_FAILED = 'Connection failed'

                                                                                                                                                member REALTIME_SUBSCRIPTION_INIT_ERROR

                                                                                                                                                REALTIME_SUBSCRIPTION_INIT_ERROR = 'AppSync Realtime subscription init error'

                                                                                                                                                  member SUBSCRIPTION_ACK

                                                                                                                                                  SUBSCRIPTION_ACK = 'Subscription ack'

                                                                                                                                                    member TIMEOUT_DISCONNECT

                                                                                                                                                    TIMEOUT_DISCONNECT = 'Timeout disconnect'

                                                                                                                                                      Type Aliases

                                                                                                                                                      type ObserverQuery

                                                                                                                                                      type ObserverQuery = {
                                                                                                                                                      observer: ZenObservable.SubscriptionObserver<any>;
                                                                                                                                                      query: string;
                                                                                                                                                      variables: object;
                                                                                                                                                      subscriptionState: SUBSCRIPTION_STATUS;
                                                                                                                                                      subscriptionReadyCallback?: Function;
                                                                                                                                                      subscriptionFailedCallback?: Function;
                                                                                                                                                      startAckTimeoutId?: ReturnType<typeof setTimeout>;
                                                                                                                                                      };

                                                                                                                                                        Package Files (9)

                                                                                                                                                        Dependencies (8)

                                                                                                                                                        Dev Dependencies (2)

                                                                                                                                                        Peer Dependencies (0)

                                                                                                                                                        No peer dependencies.

                                                                                                                                                        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/@aws-amplify/pubsub.

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