Type alias Handler<P, C>

Handler<P, C>: {
    content?: AnyBack<P, "content">;
    get<O, F>(msg?, handlerFunction?, timeout?, targetSelector?, transferOptions?, adapterOptions?) => undefined | (O["getMode"] extends "collect"
        ? Promise<{
            id: string;
            reply: GetMap<P, F>;
        }[]>
        : Promise<GetMap<P, F>>);
    getCustomData(key?, targetSelector?, transferOptions?) => Serializable;
    send<F>(msg?, handlerFunction?, targetSelector?, transferOptions?, adapterOptions?) => void;
    setCustomData(key, value) => void;
}

whatever you want

Type Parameters

  • P extends PresetConfig = any

    The preset configuration of the current method.

  • C extends string[] = string[]

    The designation of one or more connection this method communicates with.

Type declaration

  • Optional content?: AnyBack<P, "content">

    The content of the message which initialized this request chain.

  • get:function
    • Function for sending data to another socket and returning one or more results.

      Type Parameters

      Parameters

      • Optional msg: SendMap<P, F>

        The data to send

      • Optional handlerFunction: string

        The name of the handler function on the target. If left empty the name of the current preset will be used.

      • Optional timeout: number

        Number of milliseconds until the request is classified as failed.

      • Optional targetSelector: F

        name or filter object based on which the receiving socket(s) will be targeted.

      • Optional transferOptions: O
      • Optional adapterOptions: Record<string, any>

        An object containing additional data to be forwarded to the outbound adapter if one is present.

      Returns undefined | (O["getMode"] extends "collect"
          ? Promise<{
              id: string;
              reply: GetMap<P, F>;
          }[]>
          : Promise<GetMap<P, F>>)

  • getCustomData:function
    • Function for retrieving customData properties from one or more connected endpoints. This function is not async and fetches the currently cached customData.

      Parameters

      • Optional key: string

        The name of the property you want to fetch If left empty the entire customData object will be fetched.

      • Optional targetSelector: ConnectionFilter<C>

        The Endpoint to query. If left empty the endpoint(s) targeted by the current Communication will be used.

      • Optional transferOptions: OptionsList

        An Options object, by default the one the Communication was inititialized with. The "dataMode" property of the options object is used to decide of the customData value of first connected endpoint is returned ("first"), or if an array of values is returned

      Returns Serializable

      Either the value of a single customData property or the entire customData object

  • send:function
    • Function for sending data to another socket without expecting a return value.

      Type Parameters

      • F extends string | Record<string, any> | FilterType<C>[]

        Default connection filter.

      Parameters

      • Optional msg: SendMap<P, F>

        The data to send to the other socket(s).

      • Optional handlerFunction: string

        The name of the handler that will receive the data on the recipient.

      • Optional targetSelector: F

        name or filter object based on which the receiving socket(s) will be targeted.

      • Optional transferOptions: OptionsList

        name or filter object based on which the receiving socket(s) will be targeted.

      • Optional adapterOptions: Record<string, any>

        An object containing additional data to be forwarded to the outbound adapter if one is present.

      Returns void

  • setCustomData:function
    • Function for modifying the the current endpoint's customData properties. The change is immediately propagated to all active connections

      Parameters

      • key: string

        The name of the property you want to change in your customData. If it already exists, it will be overwritten.

      • value: Serializable

        The new value of the property

      Returns void

Generated using TypeDoc