Class WebsocketOutbound

This object is used to configure an outbound. Outbounds are used to send data to clients and support features like authentication checks and subscription management.

Hierarchy

Constructors

  • Creates a new outbound configuration.

    Parameters

    • method: string

      The method represents a unique identifier for the outbound. Data sent is labeled using the method.

    • objConfig: {
          propertyKey: string;
          target: any;
      }

      The configuration object containing the method functionality.

      • propertyKey: string

        The name of the function within the class.

      • target: any

        The prototype of the class containing the source code of this outbound. (e.g., MyClass.prototype)

    • Optional lazyLoading: boolean

      When enabled, data is not sent initially to all clients. They can request it if needed.

    • Optional resendAfterAuthenticationChange: boolean

      When enabled, data is updated once any route with modifiesAuthentication=true is called by this connection. This can be used to automatically send the user data to the client once the client is signed in.

    Returns WebsocketOutbound

Properties

_lazyLoading: boolean = false
authenticator: WebsocketAuthenticator = null
decoratorConfigReference: WebsocketOutboundDecoratorConfig
isOutbound: boolean = false
method: string

The method represents a unique identifier for the outbound. Data sent is labeled using the method.

objConfig: {
    propertyKey: string;
    target: any;
}

The configuration object for the object method.

Type declaration

  • propertyKey: string
  • target: any
partialUpdates: boolean = false

When enabled updated data resent using subscriptions does only send differential data (inserted, updated, deleted).

resendAfterAuthenticationChange?: boolean

When enabled, data is updated once any route with modifiesAuthentication=true is called by this connection. This can be used to automatically send the user data to the client once the client is signed in.

subscribedConnections: Map<number, WebsocketConnection[]> = ...
subscribesChanges: boolean = false
subscribesFilteredChanges: MessageFilter[] = []
supportsCache: boolean = false

When enabled, data is not sent initially when the client supports caching. If the client supports caching, data is sent once the client has transmitted the cache key.

Accessors

  • get Func(): ((...data) => any)
  • Returns the decorated function with added authentication checks.

    Returns ((...data) => any)

    • The decorated function.
      • (...data): any
      • Returns the decorated function with added authentication checks.

        Parameters

        • Rest ...data: any[]

        Returns any

        • The decorated function.
  • get hasAuthenticator(): boolean
  • Checks if the decorated function has an authenticator.

    Returns boolean

    • Indicates whether the decorated function has an authenticator.

Methods

  • Checks if the provided connection is subscribed to changes for this outbound.

    Parameters

    Returns boolean

    True if the connection is subscribed, otherwise false.

  • Gets the WebSocket connections that are subscribed to changes for this outbound.

    Parameters

    • Optional key: number

      Optional key used to filter the connections. If provided, only connections with the specified key will be returned.

    Returns WebsocketConnection[]

    An array of WebSocketConnection instances that are subscribed to changes for this outbound.

  • Sends the outbound data to the provided connection.

    Parameters

    • conn: WebsocketConnection

      The WebSocket connection to send the data to.

    • Optional id: number
    • Optional groupId: number
    • Optional sendDeleteOnAuthError: boolean

    Returns Promise<void>

  • Sends the outbound data to the provided connection. If caching is enabled, the caching hash is checked in advance.

    Parameters

    • conn: WebsocketConnection

      The WebSocket connection to send the data to.

    • Optional requestConfig: {
          count: number;
          groupId: number;
          id: number;
      }
      • count: number
      • groupId: number
      • id: number
    • Optional sendDeleteOnAuthError: boolean

    Returns Promise<void>

  • Checks whether the data has been changed and sends the updated data to the client.

    Parameters

    • conn: WebsocketConnection

      The WebSocket connection to send the data to.

    • specificHash: number

      The specific hash value

    Returns Promise<void>

  • Sends the outbound data to the provided connection if it is subscribed to changes.

    Parameters

    • conn: WebsocketConnection

      The WebSocket connection to send the data to.

    • Optional sendDeleteOnAuthError: boolean

    Returns Promise<void>

  • Sends updated data to all subscribed connections for the specified key or for all changes.

    Parameters

    • Optional key: number

      Optional key for filtering the connections to update.

    Returns Promise<void>

  • Subscribes the provided connection to this outbound's changes.

    Parameters

    • conn: WebsocketConnection

      The WebSocket connection to subscribe.

    • response: any

      The response object associated with the subscription.

    Returns Promise<void>

Generated using TypeDoc