Class WebsocketOutbounds

Manages all used outbounds. All active outbounds must be registered using WebsocketOutbounds.addOutbound(...). Registered outbounds are sent to clients automatically when they open a connection. Eager loading and lazy loading are supported, with eager loading being the default strategy. Note: Outbounds registered using decorators are not automatically added again.

Hierarchy

  • WebsocketOutbounds

Constructors

Properties

connections: WebsocketConnection[] = []
forGroupConfigs: Map<string, DecorableFunction> = ...
forIdConfigs: Map<string, DecorableFunction> = ...
outbounds: Map<string, WebsocketOutbound> = ...

Accessors

Methods

  • Checks if an outbound configuration with the specified method exists.

    Parameters

    • method: string

      The method of the outbound configuration.

    Returns boolean

    The registered outbound configuration, or undefined if not found.

  • Loads the decorator configuration for all WebSocket outbounds. Iterates through each route and invokes the loadDecoratorConfig method to load the configuration.

    Returns void

  • Remove an registered outbound

    Parameters

    • method: string

      Method of the outbound to be deleted

    Returns boolean

    true if an element in the Map existed and has been removed, or false if the element does not exist.

  • Re-sends all outbounds to the connection where the resendAfterAuthentication flag is present.

    Parameters

    Returns Promise<void>

  • Sends the provided message data to all WebSocket connections that are subscribed to the specified outbound method.

    Parameters

    • outboundMethod: string

      The method of the outbound for which to send the message data.

    • method: string

      The method representing the message data being sent.

    • data: any

      The data to be sent as part of the message.

    • Optional key: number

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

    Returns void

  • Triggers the requested outbound to be sent to the given connection. The connection automatically subscribes for updates when it is enabled in the outbound config.

    Parameters

    • method: string

      Method of the requested outbound.

    • connection: WebsocketConnection

      The WebSocket connection to send the outbound data to.

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

      Can contain addidional parameters associated with the request, like the length of data (if partially-loaded outbound)

      • count: number
      • groupId: number
      • id: number

    Returns Promise<void>

  • Sends all outbound data to a client. This is triggered once the client opens a new connection. The connection automatically subscribes for updates when it is enabled in the outbound config.

    Parameters

    Returns Promise<void>

  • Sends updated data to all subscribed connections for the defined methods. Once the first outbound (method[0]) has been updated, the promise is resolved.

    Parameters

    • methods: string[]

      Methods of the outbounds to be updated.

    • Optional key: any

      Optional key for filtering the connections to update.

    Returns Promise<void>

  • Sends the current state of data to subscribed connections for the specified method. This method is responsible for sending updated data to connections that have subscribed to the specified method.

    Parameters

    • method: string

      The method of the outbound that should be updated.

    • Optional key: number

      Optional key for filtering the connections to update.

    Returns Promise<void>

    Throws

    If the outbound for the specified method does not exist or subscription is not enabled.

Generated using TypeDoc