ART Framework API Docs
    Preparing search index...

    Class TypedSocket<DataType, FilterType>

    A generic class for implementing a publish/subscribe pattern with filtering capabilities. Designed for decoupling components, particularly UI updates from backend events.

    Type Parameters

    • DataType
    • FilterType = any

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Optional: Retrieves historical data. This base implementation is empty. Subclasses might implement this by interacting with repositories.

      Parameters

      • Optional_filter: FilterType
      • Optional_options: { limit?: number; threadId?: string }

      Returns Promise<DataType[]>

    • Notifies all relevant subscribers with new data.

      Parameters

      • data: DataType

        The data payload to send to subscribers.

      • Optionaloptions: { targetSessionId?: string; targetThreadId?: string }

        Optional targeting options (e.g., targetThreadId).

      • OptionalfilterCheck: (data: DataType, filter?: FilterType) => boolean

        A function to check if a subscription's filter matches the data.

      Returns void

    • Subscribes a callback function to receive notifications.

      Parameters

      • callback: (data: DataType) => void

        The function to call when new data is notified.

      • Optionalfilter: FilterType

        An optional filter to only receive specific types of data.

      • Optionaloptions: { threadId?: string }

        Optional configuration, like a threadId for filtering.

      Returns UnsubscribeFunction

      An unsubscribe function.