ART Framework API Docs
    Preparing search index...

    Interface ITypedSocket<DataType, FilterType>

    Generic interface for a typed publish/subscribe socket.

    interface ITypedSocket<DataType, FilterType = any> {
        getHistory(
            filter?: FilterType,
            options?: { limit?: number; threadId?: string },
        ): Promise<DataType[]>;
        notify(
            data: DataType,
            options?: { targetSessionId?: string; targetThreadId?: string },
        ): void;
        subscribe(
            callback: (data: DataType) => void,
            filter?: FilterType,
            options?: { threadId?: string },
        ): () => void;
    }

    Type Parameters

    • DataType
    • FilterType = any
    Index

    Methods

    • Optional method to retrieve historical data from the socket's source.

      Parameters

      • Optionalfilter: FilterType

        Optional filter criteria.

      • Optionaloptions: { limit?: number; threadId?: string }

        Optional configuration like threadId and limit.

      Returns Promise<DataType[]>

    • Notifies subscribers of new data.

      Parameters

      • data: DataType

        The data payload.

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

        Optional targeting information (e.g., specific thread).

      Returns void

    • Subscribes a callback function to receive data updates.

      Parameters

      • callback: (data: DataType) => void

        The function to call with new data.

      • Optionalfilter: FilterType

        Optional filter criteria specific to the socket type.

      • Optionaloptions: { threadId?: string }

        Optional configuration like target threadId.

      Returns () => void

      An unsubscribe function.